Skip to content

Commit b922fc7

Browse files
Steve TherrienSteve Therrien
Steve Therrien
authored and
Steve Therrien
committed
Improve Specifc Slide action: trigger other playlists + relative slides.
1 parent a35afcf commit b922fc7

File tree

3 files changed

+78
-19
lines changed

3 files changed

+78
-19
lines changed

HELP.md

+39-7
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,35 @@ Command | Description
88
------- | -----------
99
Next Slide | Advances to the next slide in the current document. If at the end of a document, will advance to the start of the next document in the playlist.
1010
Previous Slide | Moves to the previous slide in the current document. If at the start of a document, will move to the start of the previous document in the playlist.
11-
Specific Slide | Moves to that slide number. A slide number of `0` will trigger the current slide, which can be used to bring back a slide that was cleared using `Clear All` or `Clear Slide`.
11+
Specific Slide | Moves to that presentation/slide number. See the `Specific Slide` section below.
12+
13+
### Specific Slide
14+
This action has two parameters:
15+
16+
**Slide Number**: Moves to the slide number specified.
17+
18+
A whole number greater than 0 will move the presentation to that slide number.
19+
20+
A slide number of `0` will trigger the current slide, which can be used to bring back a slide that was cleared using `Clear All` or `Clear Slide`.
21+
22+
A relative number (prefixed with `+` or `-`) will move the presentation +/- that many slides. `+3` will jump ahead three slides, and `-2` will jump back two slides. Try to avoid using `-1` or `+1` relative numbers; use the `Next Slide` and `Previous Slide` actions instead, as they perform better.
23+
24+
25+
**Presentation Path**: Lets you trigger a slide in a different presentation, even from a different playlist.
26+
27+
*Important: Presentation path numbering starts at 0, meaning `0` will trigger a slide in the first presentation in the playlist.*
28+
29+
A single number, like `3`, will let you trigger a slide in the *fourth* presentation in the **current playlist**.
30+
31+
A path like `1:3` will trigger presentation #4 in playlist #2.
32+
33+
Playlists in groups (or nested groups) are identified using periods. `1.1.0:2` means "The second playlist is a group. The second item in that group is another group. Select the first playlist in that group. Choose the third presentation in the playlist."
34+
35+
The below image may make this more clear:
36+
37+
![specific-slide](documentation/images/specific-slide.png)
38+
39+
1240

1341
## Clear/Logo
1442
Command | Description
@@ -20,6 +48,16 @@ Clear Slide | Clears the current slide (foreground and background)
2048
Clear Telestrator | Clears all annotations drawn with the telestrator
2149
Clear to Logo | Clears all the layers and shows the logo image set in ProPresenter
2250

51+
### Clear All
52+
Note: When the `Clear All` action is triggered against ProPresenter for Windows, the current slide will be lost but on Mac it's preserved.
53+
54+
For example, if you're on slide #5, trigger `Clear All`, and then trigger `Next Slide`:
55+
- On Mac you'll be on slide #6
56+
- On Windows, you'll be on slide #1
57+
58+
You can work around this PC limitation by using the `Specific Slide` action with a relative slide number of `+1` to move to the next slide. This would move you to slide #6 after the `Clear All` action.
59+
60+
2361
## Stage Display
2462
Command | Description
2563
------- | -----------
@@ -35,9 +73,3 @@ $(propresenter:current_slide) | The number of the active slide (>= 1), or "N/A"
3573
$(propresenter:total_slides) | The total number of slides in the current document, or "N/A" if unknown.
3674
$(propresenter:presentation_name) | The name of the current presentation, or "N/A" if unknown.
3775
$(propresenter:connection_status) | The current connection status to ProPresenter ("Disconnected" or "Connected").
38-
39-
40-
----
41-
42-
43-
FOR BEST PERFORMANCE ADD DOCUMENT TO PLAYLIST (propresenter like to dump loads of info down the connection if you use it directly from the library)
61.8 KB
Loading

index.js

+39-12
Original file line numberDiff line numberDiff line change
@@ -331,12 +331,20 @@ instance.prototype.actions = function(system) {
331331
label: 'Specific Slide',
332332
options: [
333333
{
334-
type: 'textinput',
335-
label: 'Slide Number',
336-
id: 'slide',
337-
default: 1,
338-
regex: self.REGEX_SIGNED_NUMBER
339-
}
334+
type: 'textinput',
335+
label: 'Slide Number',
336+
id: 'slide',
337+
default: 1,
338+
regex: self.REGEX_SIGNED_NUMBER
339+
},
340+
{
341+
type: 'textinput',
342+
label: 'Presentation Path',
343+
id: 'path',
344+
default: '',
345+
tooltip: 'See the README for more information',
346+
regex: '/^$|^\\d+$|^\\d+(\\.\\d+)*:\\d+$/'
347+
},
340348
]
341349
},
342350
'clearall': { label: 'Clear All' },
@@ -393,21 +401,40 @@ instance.prototype.action = function(action) {
393401
break;
394402

395403
case 'slideNumber':
396-
var index = parseInt(opt.slide) - 1;
404+
var index = self.currentState.internal.slideIndex;
405+
406+
if(opt.slide[0] === '-' || opt.slide[0] === '+') {
407+
// Move back/forward a relative number of slides.
408+
index += parseInt(opt.slide.substring(1), 10) * ((opt.slide[0] === '+') ? 1 : -1);
409+
index = Math.max(0, index);
410+
} else {
411+
// Absolute slide number. Convert to an index.
412+
index = parseInt(opt.slide) - 1;
413+
}
397414

398415
if(index < 0) {
399416
// Negative slide indexes are invalid. In such a case use the current slideIndex.
400-
// This allows the "Specific Slide", when set to 0 (index is -1), to trigger the
401-
// current slide again. Can be used to bring back a slide after using an action
402-
// like 'clearAll' or 'clearText'.
417+
// This allows the "Specific Slide", when set to 0 (thus the index is -1), to
418+
// trigger the current slide again. Can be used to bring back a slide after using
419+
// an action like 'clearAll' or 'clearText'.
403420
index = self.currentState.internal.slideIndex;
404421
}
405422

423+
var presentationPath = self.currentState.internal.presentationPath;
424+
if(opt.path.match(/^\d+$/) !== null) {
425+
// Is a relative presentation path. Refers to the current playlist, so extract it
426+
// from the current presentationPath and append the opt.path to it.
427+
presentationPath = presentationPath.split(':')[0] + ':' + opt.path;
428+
} else if (opt.path !== '') {
429+
// Use the path provided. The option's regex validated the format.
430+
presentationPath = opt.path;
431+
}
432+
406433
cmd = JSON.stringify({
407434
action: "presentationTriggerIndex",
408435
slideIndex: index,
409436
// Pro 6 for Windows requires 'presentationPath' to be set.
410-
presentationPath: self.currentState.internal.presentationPath
437+
presentationPath: presentationPath
411438
});
412439
break;
413440

@@ -504,7 +531,7 @@ instance.prototype.onWebSocketMessage = function(message) {
504531
case 'presentationSlideIndex':
505532
// Update the current slide index.
506533
var slideIndex = parseInt(objData.slideIndex, 10);
507-
534+
508535
self.currentState.internal.slideIndex = slideIndex;
509536
self.updateVariable('current_slide', slideIndex + 1);
510537
break;

0 commit comments

Comments
 (0)