Real time workflow
Developer's time workflow
As I announced at the start, for several reasons I preferred to use JS instead of Expressions in an Advanced action as was the case for the older blog post. I propose two scripts. The first one is close to the older blog post, because I use the same system variables, and two methods of the JS interface for Captivate. Details can be found in this document.
In the second script I skipped using the known system variables, replaced them by some more methods of the same document.
The system variables used in the first script are:
- cpInfoFrameCount: its value is the total number of frames in the Project Info panel (see first screenshot in this article)
- cpInfoFPS: each movie is played at a certaing speed, which defines its qualtiy. It is indicated as Frames per Second. The higher that rate, the higher the quality
- cpInfoCurrentFrame: indicates the present frame number. Frames are numbered, starting with 0, not per slide but for the whole project. More details can be found in this blog post about Micro-navigation
In Captivate I created these user variables to display the results in the project:
- v_total: total duration of the project in seconds
v_done: sum of the duration of the previous slides in seconds
v_perc: percentage of duration viewed, in %
- frames: will start with the value of cpInfoFrameCount and end after calculation return the total project duration (secs)
start: will start with a frame number (frist frame of the present slide) and after calculation return the alreadu viewed duration (secs)
speed: will store the value of cpInfoFPS
percent: will return the percentage viewed after calculation
I am using two methods from the Common JS Interface:
- getVariableValue to store the values of Captivate's system variables in the JS variables frames, speed, start. (lines 1-3)
- setVariableValue to return the results to the Captivate variables v_total, v_done and v_perc (lines 6-7,9)
The calculations in lines 4-5 and 8 are straightforward. To control the formatting of the numbers I used the method 'Number.toFixed(x)'. I didn't want to display two decimals for a simple reason: the first frame will be detected on each slide, and that would have led to a duration of 0,03 seconds on the first slide (30 seconds in a frame). It would be possible to split up the results in minutes and seconds as well. I wanted this example to be a simple introduction to JS newbies. I planned to use the formatting in a third article about numbers. The first two were 'Playing with numbers - part 1' and 'Playng with numbers - part 2'. Both were meant as simple intro to JS for newbies. However, since they didn't get a lot of viewers, I gave up spending more time on it.
No system variables here, the user variables and variables in JS are the same as in the first script: v_total, v_done, v_perc, frames, speed, start, percent.. Have a look at the script:
I didn't need the method getVariableValue in this case but used three more methods on top of setVariableValue to return the results to Captivate:
- getPlaySpeed: returns the same value as the system variable cpInfoFPS (line 1)
getCurrentFrame: returns the same value as the system variable cpInfoCurrentFrame (line 2)
getDurationInSeconds: spares me one calculation, this value doesn't exist as system variable. This time I don't have to divide the total number of frames (exists as getDurationInFrames) by the FPS value. (line 3)
The other lines in the script are similar to those explained in the first script.