Script Editor Icon

Inserting conditional statements into your script

You can add prewritten conditional “If-Then-Else” statements to your scripts using the shortcut menu (also known as the contextual menu.)

The shortcut menu has several types of conditional statements that can be inserted around the currently selected text.

If you insert a conditional statement to handle a selected list, each list item is given its own conditional statement.

To insert conditional statements into your script:

Step 1

Select the list of items to be conditioned. Be sure to include the list’s curly brace characters in the selected text.

Step 2

Control-click in the selected area.

Step 3

Enter the name of the variable to be used in the comparison.

Step 4

Choose the conditional statement you want to use from the Conditionals submenu.

Step 5

Choose the desired comparison operator to use. The conditional script creates a conditional block with a condition for each list item and places it below the previously selected list.

Related Topics

Scripting made easy

shortcut menus