Fixing Typical Errors
Some errors are classics: They crop up in every new scripter's efforts and are all very easily fixed. Before you try troubleshooting your scripts from scratch, check this group of suggested problems and their solutions.
To fix missing or wrong records
1 .If the troublesome script is supposed to find a certain set of records, choose Scripts > ScriptMaker (Control+Shift+S/ Command+Shift+S).2 .In the Define Scripts dialog box, double-click the script you want to check.3 .When the Edit Script dialog box appears, double-click the Perform Find step in the script-assembly list.4 .When the Specify Find Requests dialog box appears, double-click to select the Find Request for the script you are running (Figure 10.3).
Figure 10.3. Update the Find Request by correcting its specifications.

Figure 10.4. Choose to do a regular or an inverted Find in the Action drop-down list.
[View full size image]

To fix an incorrect sort
1 .If your script has any Find steps, make sure you follow the steps in the previous section "To fix missing or wrong records."2 .Choose Scripts > ScriptMaker (Control+Shift+S/Command+Shift+S).3 .In the Define Scripts dialog box, double-click the script you want to check.4 .When the Edit Script dialog box appears, double-click the SortRecords step in the script-assembly list.5 .When the Sort Records dialog box appears, check that the table occurrence in the drop-down list on the left is correct. Change the sort fields and their order as needed (Figure 10.5). Click OK three times to finish.
Figure 10.5. Update the Sort Records information by reordering them in the Sort Records dialog box.

To fix an incorrect print format
1 .Choose Scripts > ScriptMaker (Control+Shift+S/Command+Shift+S).2 .In the Define Scripts dialog box, double-click the script you want to check.3 .When the Edit Script dialog box appears, double-click the Print or Print Setup steps in the script-assembly list. When the Print or Print Setup dialog box appears, change the format as needed. Click OK.4 .In the Script Step Options section, uncheck "Perform without dialog" if it is checked (Figure 10.6).
Figure 10.6. When you uncheck "Perform without dialog," the script will pause and let you see the print settings and change them if necessary.

To make a script end on a different layout
1 .Choose Scripts > ScriptMaker (Control+Shift+S/Command+Shift+S).2 .In the Define Scripts dialog box, double-click the script.3 .When the Edit Script dialog box appears, highlight the last script step in the script-assembly list (Figure 10.7).
Figure 10.7. Highlighting a script step allows you to insert a new step directly below it.

Figure 10.8. You can choose any layout as the ending place for the script.

To fix a loop that won' t end
1 .Choose Scripts > ScriptMaker (Control+Shift+S/Command+Shift+S).2 .In the Define Scripts dialog box, double-click the script.3 .When the Edit Script dialog box appears, look for a Go to Record/Request/Page step. If you see one, click to select it.4 .Under Script Step Options, check the "Exit after last" check box (Figure 10.9). Click OK, twice to finish.
Figure 10.9. Make sure that the script exits after the last record.

Figure 10.10. This script has no step to tell it when to exit the loop.

Figure 10.11. Looping scripts need to be told when to exit.

The Allow User Abort script step (Figure 10.12) controls whether you can cancel a running script. When you're creating and testing scripts that contain loops, add it as the first line of your script and set its option to On. When the script runs, you can stop it by pressing Escape (Windows) or Command+period (Macintosh). If you have sub-scripts in your script that call steps you might want to cancel, you'll need to place an Allow User Abort step in them and turn it on as well.
Figure 10.12. This loop has no Exit condition, so it will never end unless you can manually cancel the script.

Figure 10.13. When Allow User Abort is on, the Cancel button appears in Find mode.

