Balance.htmlTEXTVIZFɴWWZ About Balance

About Balance


What is 'Balance' ?

"Balance" is a user script. It makes scripting easier, faster, and safer. It has a shortcut (   E). When the cursor is in a script line, and you press   E, the script tries to find some way to help you. For instance, it will close some parenthesis, or suggest a syntax.

To launch it, choose 'Balance' in the Scripts menu, or press the shortcut   E.

What can 'Balance' do for me ?

- Suggest a syntax
Write an AppleScript verb in any window (text or script window). Select it, then press   E. 'Balance' will replace the selected verb by the suggested syntax. Example:

----------------------------
choose file
----------------------------

... is turned into ...

----------------------------
choose file with prompt MyString of type MyList
----------------------------

- if the verb belongs to the dictionary of a scripting addition, the script will always suggest a syntax.
- if the verb belongs to the dictionary of an application, the script must have been linked to the said application, by the 'tell ...' menu.
- if the verb belongs to the dictionary of Smile, the script will work only if the window has not been linked to any application (thus, it is the case for any new script or text window).

- Close parenthesis, brackets, braces and quotes
Put the caret at the end of the line. Press   E. If unbalanced parenthesis, brackets, braces or quotes can be balanced, the script does it for you. If a faulty pattern is encountered, the concerned character gets hilited. Example:

----------------------------
set theLength to 2*(1+(contents of item i of {"Good","Better","Excellent
----------------------------

... is turned into ...

----------------------------
set theLength to 2*(1+(contents of item i of {"Good","Better","Excellent"}))
----------------------------

- Close wrappers
Write the first line of the wrapper. Press   E. The script will write the last line of the wrapper, make a new line inbetween, indent it, and put the caret there. Example:

----------------------------
repeat 12|
----------------------------

(where the vertical bar represents the caret)
... is turned into ...

----------------------------
repeat 12
|
end repeat
----------------------------

Supported wrappers are :
on, to, if, repeat, script, considering, ignoring, else, try, tell.

- Show the indentation
Even if you use a small font, you may need to check the indentation over much more than one window height. This is almost impossible, because nothing makes the alignment visually persistent when you scroll.
To check the indentation of a script (even a compiled script) select several paragraphs and press   E. The script gets colorized, each indentation level having its own color. Then, it is easy to check if lines are correctly aligned with each other, even if they are very far apart. (non handled: continuation characters, and some complex lines such as "if (...) then tell ...")
- Help writing 'tell' statements
Write "tell". Press   E. You will be asked to choose a running application. Choose one, the script will write it as the target of the 'tell'.

jj_~5Z6 O¿~5L3 M~~5L2J~5L/H~~~5L-""77̙~5L+" f~5L)" 33~~5L'"""Df5L%""70##""PP7 [9aP7P<7 Y[9aPa<7V[<< Uݙ[<: Sݙ[<n8 Q}5[ ~    k  '  k   k  3  kJ    k    k    k  )  k>  C  k_  d  kk    k  :  kO  T  kp  u  k|    k    k  -  k5    k    k    k  #  k+  K  kO  ^  kb    k    k    k    k  '  k/    k    G  V  Z  e  ki  '  k2  g  ko    k    k    k   k   k    k   9  k A  [  k c   k   k   k     k #  R  k g  l  k   k    k   >  k B  P  k T  t  k |   k   k   k    k     k   #  k '  G  k O  k  k o   k   k    k    k3  8  kT  Y  k`  y  k    k    k    k    k    k  selelist longwlongwpbndlist8longlong/longlongBDrwfalspvistrueWIDLfalsICFFlongrSiDlongptxfTEXTGenevaptpslong Rectlist8longlonglonglongWTBHlongRqULlongLWdtlongBrWdlongAuAdfalsTbSzlong scptscptVFasdUAS 1.101.10  misccura"  CONT  misccura  cwtxQ  kfrmID ascr ޭjj_; #BZstylSOUP&reco2 ;cwtx