Meet Script Debugger’s debug mode! Debugging a script is like running it, except that in debug mode your script can pause in the middle.
Debugging is a separate mode; it’s a feature of your script. A script is either in debug mode or it isn’t. To turn on debug mode for a script:
Choose Script > Enable Debugging. If the menu item is checked, debug mode is on.
In debug mode, a script window’s appearance changes slightly:
NOTE: In the above screen shot, the toolbar icons are small and the names of the buttons have been removed, to save space.
In debug mode:
The Debugging button in the toolbar says ON.
The Step buttons (Trace, Step Over, Step Into, Step Out) and Breakpoints button appear in the toolbar (by default).
To turn off debug mode:
Choose Script > Enable Debugging. If the menu item is unchecked, debug mode is off.
NOTE: You might have to stop your script (choose Script > Stop, or click Stop in the toolbar) before you can turn off debug mode. You can’t turn off debug mode if your script is running or paused.
Debug mode is a script feature; it is saved as part of a script file. It is also unique to Script Debugger. A script saved in debug mode is unusable except in Script Debugger. Therefore, when you’re finished debugging, you will probably want to save your script not in debug mode.
There is, however, one good reason for deliberately saving a script in debug mode and running it elsewhere — so that you can debug externally.
Debug mode gives your script (and you) many new powers.
Your script can pause in the middle of execution.
You can observe how one handler calls another.
If your script involves driving a scriptable application’s interface, it may help you to work in the Mini Debugger, where you can interact with breakpoints and pauses in your script while keeping the scriptable application frontmost.