For example, your quiz has an essay question with both minimum and maximum word limits. You want to count the number of words and display it to your learners so that they know whether they respect the limit. The essay question may look like this:
Step 1: Click the Properties pane > Events – Actions.
Step 2: Add an event to an object or slide. In this example, you want learners to click the button to see the number of words they’ve written. So, add the On Click event to the Count_Button.
Your script may look like below. Briefly, the script gets the text typed in the Essay_Question text box, calculates the words, and then sets the value of the wordCount variable with the number of words.
Step 5: Click OK to finish. Next, in the Home tab or Export tab, click HTML5 Preview to preview your project in browser. Type some text in the text box and count the number of words.
If you want to run a script when the project loads, perform the following:
Step 1: Click the ActivePresenter button > Project > Properties.
Step 2: In the Project Properties dialog, switch to the Event tab and write your code.
The script above checks if a learner fails the lesson. If so, the lesson will be marked incomplete instead of completed even when it’s finished. By default, ActivePresenter marks a lesson completed when learners finish it, even if they fail. If you want the lesson to be marked incomplete when learners fail, run the script.
Customizing the Script Editor
If your experiments go haywire, you can always restore to the defaults by clicking the Restore Defaults button (2).
- Change the color of the editor components (3): Click the color rectangle next to the component in the component list, and then select a color in the Color Picker.
- Change the code view options: Select the check boxes to show line numbers (4), show dots in place of white space (5), and insert matching closing brackets to the code (6).
That’s how to add custom scripts in ActivePresenter. Try it out to extend the functionality of your course.