Textwindow.htmlTEXTVIZF!1]1]zT Text Windows

Text Windows

Introduction

Text windows can be used for editing styled text. But, in addition, they offer a superior environment to edit, debug and perfect scripts, before the final making of a handler, an applet or a droplet.
Any text document, including uncompiled scripts, open as text windows. Text windows are white in color, while the script windows are colored. To create a new text window, select "New text" (  N).

Scripting in text windows

- When you press the Enter  key (not the Return key) in any text window, the current paragraph or the selected text is compiled, and executed if it is executable. If you have no Enter key, use ctrl-C.
- Variables are persistent in text windows. So, you can easily (re-)set/reuse your variables (by executing the line "set myVariable to something" somewhere in the window) and execute only those lines that appear to cause trouble.
- The result returned by the execution is appended at the end of the text, optionally preceded by double dashes "--" (AppleScript comments). This is the default behavior, it may be changed with the Preferences settings and the optional redirecting of the outputs.
- You can run short scripts on the fly. You can also execute long scripts line-by-line, or block by block.
- You can link a text window to a (running) application. Script lines entered in such a window will be sent directly to the application.

Debugging in text windows: the rules

Scope of variables and handlers
The variables and the handlers defined in a script run from a text window are persistent and available in the same window as long as it remains open. This allows the line-by-line scripting and testing. (If a variable is included within a handler, a 'global' declaration must be used to extend its scope outside the handler.)
Smile's context
All the text windows which are not currently linked to any application (see the tell ... feature) share a common context, Smile's context: the variables and handlers defined in one are available from the other. See also the routines about the functions available.
Saved variables - The "my" prefix
Global variables which are created (and accessed) using the 'my' prefix are saved when the user quits Smile.

The Worksheet

Smile has a special text window, named "Worksheet". It can be used as a notepad. For more details, see Worksheet .

Editing text

- Smile text windows work similarly to other styled text editors. Text can be edited using the Smile editing tools available from the menus ( "Edit" and "Text" ), shortcut keys , mouse and drag-and-drop.
- The line width can be set for each window on an individual basis using "Line width..." and "Fit to window" in the "Text" menu.
- The tab width can also be set in the "Text" menu. Alternately, each window can be set to "Fit to window" in the "Text" menu.
The default for new windows can be set thru the "Preferences" dialog .


 _M L0ΒBK~(p6=Lap%sݎSi9WZXAˌ:#I8!Ȃ@oB4Cnދ2,% A.6fCgA8?%5C4!@'B~](rQJ9}Q{rr(1èhvmABC`- q*`iLzR /c