Once you've figured out what kind of conditional step you need, you create the script in ScriptMaker. The syntax for a simple If statement to print a statement isn't much more complex than plain English.
1 .Choose Scripts > ScriptMaker (Control+Shift+S/Command+Shift+S). When the Define Scripts dialog box appears, click New.
2 .When the Edit Script dialog box appears, type a descriptive name for the script in the Script Name text box (in this case Account Balance).
3 .Under the Control category in the script step list on the left, double-click If (Figure 8.1).
When you add If to a script, you'll see two lines in the script steps: If and End If (Figure 8.2). End If is added by default every time you choose If to mark the place in the script where the If steps end. Everything you want in your If statement must be placed between If and End If.
Chapter 4, "Calculation Fields").
5 .In the field list on the left, scroll to find your field (we use Balance Due). Double-click to add it to the formula box (Figure 8.3).
6 .Choose the greater than (>) symbol from the Operators scrolling list by double- clicking it.
7 .Type 0 (zero), then click OK (Figure 8.4). The script-assembly list now displays the highlighted If statement with its condition (Figure 8.5).
8 .
In the script step list on the left, double-click the action you want performed. We choose Perform Script, because we want to run a print statement script we've already created (Figure 8.6).
Chapter 7, "Creating Simple Scripts.") Any script steps can be placed inside an If stepeven another If step.
9 .In Script Step Options, click the Specify button to bring up the "Specify Script" Options dialog box. In the scrolling list, double-click the script that you want performed if there's a balance due (Figure 8.7). Since you don't have anything else you want the script to do if there's no balance due, the If statement is finished.
10 .Click OK twice to close ScriptMaker.
You can just type a simple condition in the formula box for a statement, such as "Balance Due > 0". However, when you start creating more complicated scripts, or if your fields have long names, it's better to select field names and operators, as well as functions, from the scrolling lists. You must have a field that exactly matches what's in the conditional statement so that FileMaker can check its value. One of the hardest and most time-consuming aspects of scripts is that they frequently won't work right simply because you didn't catch a typing error.