Script Debugger provides convenient ways to view and navigate the structure of your AppleScript code in a script window.
To jump from handler to handler, successively:
Choose Edit > Go to Next Handler or Edit > Go to Previous Handler.
The handler name in the first line of the handler definition is selected. Handlers do not have to be at top level; for example, a handler inside a script object counts as a handler (and so does a handler inside a script object inside a handler).
The navigation bar (above the text area in a script window) has two functions:
It shows where you are. The current selection is described, in the following format:
lineNumber:characterNumber ∆ length symbolName
For example:
7:3
means the selection starts at character 3 of line 7.
∆ 6
means the selection is 6 characters long (this will be absent if there’s just an insertion point).
on myScript's pad(s)
means the selection is in the handler pad
(taking one parameter, s
), which is itself inside the script object myScript
.
The Editor preference “Show navigation bar location when scrolling” causes a tooltip, similar to the navigation bar contents, to appear when you scroll your script. The tooltip shows the location of the top of the visible portion of the script.
It lets you survey and navigate your script’s structure. Click the navigation bar to summon the table of contents pop-up menu.
The menu lists top-level entities (script objects, properties, handlers), along with embedded entities shown hierarchically. There are two possible orders:
Alphabetically by category:
Global variables, in alphabetical order.
Script objects, in alphabetical order.
Properties, in alphabetical order.
Handlers, in alphabetical order.
The order in which they appear in the script.
The order you’ll see depends upon your choice in the Editor preferences checkbox, “Sort table of contents menu alphabetically.” Hold Shift to display the menu in the other order.
Hold Option to eliminate properties and globals from the display.
You can show and hide the navigation bar, to save space. To do so:
The same table of contents menu that pops up in the navigation bar also appears in the contextual menu. Control-click in the text area and choose Go To. The same modifier keys work (Option and Shift) if you hold them while summoning the contextual menu.
A marker is a comment in your script that appears in the table of contents menu so that you can easily jump to it. Markers always appear first in the table of contents menu.
A marker is an AppleScript comment that starts with -->>
.
If text substitution is turned on, -->>
may be converted to --»
as you enter it, but it’s still a marker.
If line contains a marker, a “droplet” symbol appears in the gutter: