LNS Home
Script Debugger
Download & Buy
x Explore
x Edit
x Run & Debug
x Deploy
What's New In 4.5
bullet Documentation
bullet Blog Posts
My SD Story
Software Updates
 
4.0.9 Update
3.0.9 Update
bullet 2.0.5 Update
x Free Downloads
 
XML Tools
XSLT Tools
x Property List Tools
x List & Record Tools
Register Your Copy of Script Debugger
Join the Script Debugger Mailing List
x AppleScript/ Scripting Links
Products
x Script Debugger 4.5
Site Contents
bullet Mark’s Blog
Product Registration
Bug Reporting
x Freeware
Contacting Us

SD4 Headling


image

Block Structure

image

A pervasive and characteristic feature of AppleScript code is its block structure — a tell line is balanced by an end tell line, a repeat line is balanced by an end repeat line, and so forth. Script Debugger makes it easy to create, view, and check your code’s block structure.

Block Entry (Auto-Closing)

Auto-closing is a text entry feature where, when you type Return in the opening line of a block, Script Debugger automatically creates the closing line of the block for you.

Auto-closing is turned on through an Editor preference:

  • Auto-close AppleScript blocks (end tell, etc.). If checked, auto-closing is turned on.

To test auto-closing, create a new script and type repeat. Now press Return. Script Debugger creates a corresponding end line and positions the insertion point in between, like this:

repeat
    -- your insertion point is at the start of this line
end

Now you’re ready to type the content of the repeat block. This works also for lines beginning with tell, on, script, if, try, using, considering, and ignoring. Script Debugger’s auto-closing feature is intelligent; if there is already a corresponding end line, Script Debugger won’t create one.

To reverse your auto-closing preference setting momentarily, hold down the Control key as you type Return. Thus, for example, if auto-closing is turned off and you type Control-Return in a block opening line, Script Debugger behaves as if auto-closing were turned on and creates a corresponding end line. If auto-closing is turned on and you type Control-Return in a block opening line, Script Debugger enters a return character and no more.

Block Viewing and Selection

To clarify the block structure of your script visually, you can hover the mouse in the gutter (the area to the left of the script text). Script Debugger outlines the nested block structure, starting with the block to the right of the mouse, in successively darker shades of grey.

image

This feature is turned on through an Editor preference:

  • Highlight block when mouse hovers in gutter. If checked, this feature is turned on.

When this feature is turned on, you can also select a block. To do so, click the mouse in the gutter when you see the nested block structure outlined. If you click several times in rapid succession, then each click selects the next block outwards. For example, in the above illustration, clicking once would select the repeat block; clicking twice would select the on pad block; clicking three times would select the script block; clicking four times would select the outermost on block.

Block Selection (Balance)

Another way to select a block is to use Script Debugger’s Balance command. To do so, choose Edit > Balance.

Each time you choose Edit > Balance, Script Debugger selects the block enclosing the current selection. Thus, if you choose Edit > Balance repeatedly, you select the block enclosing the insertion point, then the block enclosing that block, then the block enclosing that block, and so on.

(The Balance command starts by selecting delimited code, if the initial selection is between delimiters.)



Explore | Edit | Run & Debug | Deploy | What's New In 4.5 | My SD Story


Copyright © 1998-2009 Late Night Software Ltd. - All Rights Reserved.