Debugging scripts (FileMaker Pro Advanced)
The Script Debugger is an interactive tool for troubleshooting your FileMaker scripts.
With the Script Debugger, you can:
 •
 •
 •
 •
step into a sub-script to execute it one step at a time, or step out of a sub-script
 •
 •
 •
 •
 •
 •
 •
monitor fields, variables, and calculations
 •
To debug scripts:
1.
To enable the Script Debugger, choose Tools menu > Script Debugger.
2.
3.
 
If the script step is Perform Script, the Script Debugger will execute the sub-script, and proceed to the next line of the calling script. The Script Debugger will execute all sub-script steps until it encounters a breakpoint.
If the script step is Perform Script, the Script Debugger will step to the first line of the sub-script and await user input before proceeding to the next sub-script step.
Execute all script steps in the current script and, if the script is a sub-script, return to the line after the Perform Script step in the calling script.
If the script is not a sub-script, the Step Out command will cause the Script Debugger to execute all remaining script and sub-script steps, until it encounters a breakpoint.
Set next step button
This command passes control to the highlighted step but does not perform the step. The highlighted step is performed when script execution or debug stepping is resumed. Any script steps between the last executed step and the assigned next step are not executed. Click a step to highlight it, then click Set Next Step.
Pause button
Toggle between executing all script steps until the end of a script or a breakpoint is encountered and pausing. When a script is paused, you can double-click the script in the Call Stack list to edit it. Each active script opens in a separate Edit Script dialog box, so you can edit multiple scripts. Script execution is not halted until you save the changes.
You must have Full Access privileges to disable a script trigger. Script triggers are enabled by default. When you close the Script Debugger, all disabled script triggers are enabled.
You can also choose Tools menu > Debugging Controls > Disable Script Triggers or Enable Script Triggers.
Breakpoints allow the Script Debugger to execute large sections of a script, pausing only to inspect the section marked with a breakpoint. Breakpoints are ignored by FileMaker Pro when the Script Debugger is not in use. You can set or clear breakpoints in the Script Debugger or when you create scripts. To set a breakpoint when you create scripts, click to the left of the step. Breakpoints are saved with the script in which they are set. You can set breakpoints on multiple steps.
Note  You cannot set breakpoints on steps called by a button or custom menu.
Edit script button
Open the Edit Script dialog box to edit the current script. You can make changes to a script while it is executing, but once you save changes to the script, execution halts.
Note  To edit the script step associated with buttons or custom menu items, use the Button Setup or Manage Custom Menu dialogs.
Open/Close data viewer button
Authenticate/Deauthenticate script
You must have Full Access privileges to authenticate a script. The higher level of privileges applies to all scripts, but not to other file elements (for example, records and layouts). Your editing privileges last until you close both the Script Debugger and the Data Viewer.
4.
Select Pause on error if you want scripts to pause when errors are encountered.
For Last error, click the error number to open a Help topic with details about the error. See FileMaker Pro error codes.
Note  When you use the Script Debugger to step through enabled scripts activated by a script trigger, you can’t interact with the document windows, move between fields or records, change the data, close the window, or quit. This blocking of interaction only occurs when a script is triggered via some action. When you are debugging a script that is not activated by a script trigger, you can interact normally with the document windows, fields, and records.
Viewing sub-scripts
You can view sub-scripts when you step through scripts in the Script Debugger. For example, if Script A calls Script B, which then calls Script C, you can view the steps in all three scripts.
1.
Choose Tools menu > Script Debugger.
To open the Script Debugger from the Manage Scripts dialog box, select a script, press Shift and click Perform. To close the Script Debugger, press Ctrl (Windows) or Command (Mac OS) and click Perform. For more information on keyboard shortcuts, see FileMaker Pro Advanced keyboard shortcuts (Windows) and FileMaker Pro Advanced keyboard shortcuts (Mac OS).
2.
3.
Click Step Into.
The Call Stack list displays the sub-script.
4.
Select a script in the Call Stack list to view that script’s steps in the display area.
Notes
 •
 •
In order to facilitate proper script debugging, the Script Debugger overrides some script steps. The Allow User Abort script step with the option set to off will not prevent you from stopping the execution of a script. The Adjust Window script step with the options of hide or minimize will not hide or minimize the window when encountered through the Step Over or Step Into buttons.
 •
If a script with access privileges set to Modifiable performs a script with Executable Only access, the Executable Only script will perform in its entirety without showing its steps in the Script Debugger. If an Executable Only script performs a script with privileges set to Modifiable, only the steps in the Modifiable script will appear in the Script Debugger. To edit a script, choose Authenticate/Deauthenticate Script. For more information about script privileges and running scripts with full access, see Editing scripts privileges.
If you open the Data Viewer after choosing Authenticate/Deauthenticate Script, your access privileges are maintained in both the Data Viewer and Script Debugger until you close the Script Debugger.
 •
 •
 •
 •
 •
 •
When you debug a script that is called from a button, the button is identified in the Call Stack list by the filename and layout in which the button is located. The button name is the button object name that was assigned using the Inspector. If no name was assigned in the Inspector, <unnamed button> followed by the filename and layout appears in the list.
When the Script Debugger stops on a script step called by a button in the script step list, the text above the list changes to Button: <name of button>, or it changes to Button: <unnamed button> if no name was assigned in the Inspector.
 •
When you debug a script that is called from a custom menu, the menu item is identified in the Call Stack list by menu item name and filename. When the Script Debugger stops on a script step called by a custom menu in the script step list, the text above the list changes to Menu item: <custom menu item text>.
Related topics 
Creating and editing scripts
Using the Data Viewer (FileMaker Pro Advanced)
Topics in this section
Disabling script steps (FileMaker Pro Advanced)