Friday 14th July, 2000
For anyone getting started with AppleScript programming, help is at hand. SMILE is a freely distributable AppleScript editing environment, designed to be new-user friendly. SMILE (which stands for SMI Limited Edition) isn’t easily pigeonholed.
At first glance, it provides a straightforward script editor, which, unlike Apple’s Script Editor application, isn’t limited by the 32K text limit on scripts and has a built-in search and replace function. SMILE is also PowerPC-native, handles drag-and-drop text editing, and comes complete with good, if not quite comprehensive, Apple Help documentation.
In SMILE, there are two types of windows - text windows and script windows. When you first open SMILE, you’re greeted with the Worksheet window. This is the default text window SMILE creates for you, where you can begin to experiment with AppleScript. Text windows have a white background and although they appear to behave like a text window in any other application, they’re, in fact, interactive. If you type a line of AppleScript into the window, and then press enter (as opposed to return), SMILE evaluates or ‘runs’ that line of AppleScript for you.
You can select more than one line of code and when you press enter, SMILE will run the entire block of code. More importantly, having executed a line, any variables you’ve defined or modified remain ‘in play’,so you can effectively type in an AppleScript and step through it, a line at a time. Also, unlike other programming environments, you can choose how much of your script, or which part, to execute, simply by changing your text selection. For beginners struggling with the concepts of programming, this is a superb tool, and for anyone who’s tried to get to grips with some of AppleScript’s more esoteric syntaxes, this approach can make programming much less of a chore.
Once you’ve progressed to writing full-blown scripts, then you move over to Script windows. Initially, these behave pretty much as you’d expect if you’re used to Apple’s Script Editor. SMILE goes a couple of steps further, though. Any handlers you define within your script appear in a pop-up menu at the bottom of the window so that you can jump to them from anywhere else within a script.
The Edit menu also provides a Tell command, which sets a target application for the script you’re writing. First, this saves you the less than onerous task of using a ‘tell application… …end tell’ statement. Second, and more importantly, this adds an application pop-up menu to the bottom of the window. Here you can access the application’s AppleEvent dictionary directly. This also adds the application’s dictionary to SMILE’s search path, so you can select a term within a script and ask SMILE to search for the definition - either within the application, an AppleEvent plug-in (OSAX) or AppleScript itself.
SMILE is a fully AppleScript-compliant application. Not only is it scriptable, it’s also recordable - you can record your actions as AppleScripts - and attachable - you can attach scripts to objects within SMILE. It allows you to create a whole range of standard dialog objects - buttons, check boxes, radio buttons, groups, text boxes and so on - and to access them from within your scripts. Since much of SMILE is itself written in AppleScript (it’s still fast though) you can do things like add buttons to text windows and then command-option-click them to edit their scripts.
As a scripting tool its price-tag and lack of 32K restriction and handler searching make it hugely compelling. Add to that its sheer scriptability and forgiving nature, and it’s a must-have for any AppleScripter’s tool box.
User-friendly script editor that’s a must-have for beginners and pros alike - and it’s free.
|Get Further Info|
|Pros||Forgiving interface ˜ Eminently scriptable ˜ Recordable ˜ Attachable ˜ Good Help files|
|Cons||Power Mac only|
|Originally Published||MacUser, Volume: 16, Issue: 13, p32|