Using an If statement in a script
The If and End If actions can be used together in a script to form an If statement. You can use If statements to initiate actions when certain conditions are satisfied. For example, you can create an If statement that displays one page of a presentation if the presentation is used on a Mac and a different page of the presentation if the presentation is used on a Windows computer. To use an If statement in a script:
- In the Script tab of the Interactive palette, create a script.
- To begin the If statement, add an If action (Control > If).
- To specify the condition that must be met, choose an option from the Object Type drop-down menu; choose the object’s name from the Object drop-down menu; and then choose an option from the Is or the Has drop-down menu.
- To specify the action to be taken if the condition is met, add an action to the script immediately after the If action, and configure it to do what you want. If you want more than one thing to happen when the If condition is met, add additional actions.
- If you want to specify what happens if the If condition is not met, add an Else action (Control > Else) to the end of the script, and then follow it with one or more actions.
- To conclude the If statement, add an End If action (Control > End If) immediately after the last action.
The If, Else, and End If actions enable you to create conditional statements. In this case, a sound is played if Animation 2 is playing; otherwise, the computer beeps.
Parent topic: Using conditional statements