Using FileMaker Pro Advanced > Debugging scripts (FileMaker Pro Advanced)
 
Debugging scripts (FileMaker Pro Advanced)
The Script Debugger is an interactive tool for troubleshooting your FileMaker scripts.
With the Script Debugger, you can:
debug scripts that are run from the Scripts menu or keyboard shortcuts
debug startup scripts (the Script Debugger menu is enabled even if there are no open files)
debug a script activated by a script trigger, button, or custom menu
step into a sub-script to execute it one step at a time, or step out of a sub-script
set or clear breakpoints in your script
begin debugging from any script steps within the script
view sub-scripts as you step through scripts
debug restricted-access scripts
pause a script when script errors are encountered
monitor fields, variables, and calculations
temporarily disable or enable script triggers while you work in the Script Debugger
To debug scripts:
1. Enable the Script Debugger by doing one of the following:
Choose Tools menu > Script Debugger, then run your script.
Choose Scripts menu > Script Workspace, select your script, then click Debug button. To save all open scripts and then debug the script, hold down Shift (Windows) or Option (OS X) and click Debug button.
2. Use these controls to debug the script:
 
Choose
To
Step Over
Step over button
Execute the script one step at a time without entering sub-scripts.
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.
Step Into
Step into button
Execute the script one step at a time, as well as enter and show steps in sub-scripts.
If the script step is Perform Script, the Script Debugger will step to the first line of the sub-script and wait for user input before proceeding to the next sub-script step.
Step Out
Step out button
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
Set next step button
Set the step execution pointer to the highlighted script step.
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 button in the Script Debugger.
Run
Run button
Pause
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 tab in the Script Workspace, so you can edit multiple scripts. Script execution is not halted until you save the changes.
You can step through a script using Step Into button in the Script Debugger when a script is paused.
Halt Script
Halt script button
Halt execution of a script.
Enable/Disable Script Triggers
Enable/Disable script triggers button showing script triggers are disabled
Temporarily disable or enable all script triggers in a file.
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.
Edit Script
Edit script button
Opens the current script in the Edit Script dialog box. You can make changes to a script while it is executing, but once you save changes to the script, execution halts.
Open/Close Data Viewer
Open/Close data viewer button
Open (or close) the Data Viewer window so you can monitor specified fields, variables, and calculation formulas. See Using the Data Viewer (FileMaker Pro Advanced).
Authenticate/Deauthenticate script
Lock button to authenticate script or data viewer Unlock button to deauthenticate script or data viewer
Unlock the Script Debugger or Data Viewer for scripts that do not allow modify privileges.
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.
3. Select Pause on error if you want scripts to pause when errors are encountered.
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.
2. Perform a script that calls a sub-script.
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
To set or clear a breakpoint, click the line number to the left of the script step. 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 breakpoints on multiple steps. You cannot set breakpoints on steps called by a button or custom menu.
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, click Authenticate/deauthenticate script button in the Script Debugger in the Script Debugger. For more information about script privileges and running scripts with full access, see Editing scripts privileges.
If you open the Data Viewer after clicking Authenticate/deauthenticate script button in the Script Debugger, your access privileges are maintained in both the Data Viewer and Script Debugger until you close the Script Debugger.
You can debug a startup script by opening the Script Debugger before opening your database file.
When you close the Script Debugger while a script is paused, the script resumes and completes.
Related topics 
Creating and editing scripts
Using the Data Viewer (FileMaker Pro Advanced)