image

Outliner

image

An outliner is an interactive hierarchical display of an object’s properties and elements. An outliner may appear as Best view of an explorer or by itself as a separate view.

The display is in two columns: the name of an element or property, and the value of that element or property.

Triangles

Any line in an outliner whose value is itself an object with elements and properties is indicated by a triangle. Click a triangle to reveal or hide the elements and properties of that object. (Alternatively, select a line containing a triangle and press Right Arrow or Left Arrow.) The chief cases of values with triangles are:

Element Collections

When you reveal the elements of a collection, there may be a short delay as Script Debugger gathers information about them. If there are many elements in a collection, Script Debugger may save time (and Apple events!) by ceasing to gather information about them beyond a certain number. For example, run this script and examine the Best outliner in the results pane:

tell application "Finder"
    tell home
        get folder "Library"
    end tell
end tell

If you click the triangle next to items, some items are shown initially, followed by a Show More Items button. The number of items shown initially in these situations is governed by a Dictionary preference, “Show n elements at a time.”

image

Elements of a collection are initially gathered with reference to some particular specifier. The default specifier is governed by a Dictionary preference, the “Access Elements by” pop-up menu. Your options are Index, ID, and Name. You can change the reference specifier for an element collection using the pop-up menu next to the collection’s name in the outliner.

If a reference specifier fails (because the scriptable application doesn’t respond to it), Script Debugger automatically falls back on a different specifier and displays an exclamation-mark icon (image). For example, the Finder doesn’t implement gathering a folder’s items by ID and has trouble with item of list expressions; Script Debugger works around this behind the scenes, and displays the exclamation mark.

The same pop-up menu next to the collection’s name can also be used to replace the collection displayed with a single element. Your choices are First, Middle, Last, and Any.

Reloading

Gathering outliner information can be expensive and time-consuming (it involves sending a lot of Apple events), so Script Debugger gathers information only when it has to:

Outliners connected with your script, such as the result pane and the variables pane, automatically refresh their visible contents when you run the script or step while debugging. Otherwise, an outliner is not live. If the situation in the target application changes, you can manually request that the outliner refresh itself. To do so:

You can also ask to reload the entire outliner. (But be careful, because this may cause Script Debugger to send the target application a lot of Apple events!) To do so:

When it appears as the Best view of an explorer, a value outliner has a path widget, along with back and forth buttons. If you double-click any line within the outline, that line is hoisted so that the explorer is now exploring that value.

In a “partial explorer” (with no path widget or Best/Source/AEPrint button), double-clicking a line spawns off a separate explorer window.

The path widget displays a reference to what is being explored. When a value within an explorer is hoisted, the path widget appends a reference to that value. Thus, the path widget always displays a chain of references (equivalent to a nest of tell blocks) showing how you arrived at the value now being explored. The highlighted reference in the path widget is the one currently being explored.

image

The references in the path widget are buttons. To navigate back up the chain of references:

When you navigate up the chain of references using the path widget, the path widget continues to show the full chain, in case you want to navigate back down it again. To navigate back down the chain of references:

Script Debugger also remembers each explored object (the explorer history list). To explore again a previously explored object:

After using the Back button, you can use the Forward button, or choose Dictionary > Go Forward, to move the other way through the history list.

Filtering

You can filter the outline to show only certain attributes. To do so, use the buttons in the scope bar.

image

Your choices are:

If both Filled Elements and Empty Elements are highlighted, all element collections are shown. If neither Filled Elements nor Empty Element are highlighted, no element collections are shown. If none of the above buttons are highlighted, the outliner will be empty!

To highlight all three of the above buttons quickly and show the complete outline, choose Show All Items, Properties & Elements from the contextual menu.

A second set of buttons lets you choose to show items with respect to recent changes in value:

If neither Changed nor Unchanged is highlighted, the outliner will be empty!

The scope bar can be shown or hidden at will. Every explorer has a scope bar, including “partial explorers” like the variables pane and even the expressions pane; the scope bar is these partial explorers is hidden by default, to save space, but you can show it. To toggle the visibility of the scope bar:

Dictionary

You can jump from a line of the outline to the dictionary entry for that term. To do so:

Raw (Chevron) Syntax

You can toggle between English terminology and raw Apple event codes in an outliner. To do so:

Badges

Names in an outliner are badged according to their type.

Object values in an outliner are badged with the icon of the owning application.

Read-only scalar values in an outliner are badged with a crossed-out pencil icon (image).

Special Values

Error values (shown in orange, with a stop-sign icon) in an explorer are not problematic. They indicate that Script Debugger asked for an element or property and the application responded, in good order, with a runtime error. This is a valid response from the application.

A missing value result is also a valid response from the application.

An «empty» value is supplied by Script Debugger to indicate that the application has failed to return any value at all. This is useful information, because if you assign such a nonvalue to a variable in a script, that variable will be undefined.

In certain special cases, such as the entire contents property of the Finder, Script Debugger supplies a not loaded value so as not to request evaluation of a property whose value could take the application a very long time to return.

Editing in an Outliner

Read on to learn how you can edit a value or edit your script using an explorer’s outliner!



Outliner Editing
image