TweetFollow Us on Twitter

Satimages Smile

Volume Number: 16 (2000)
Issue Number: 10
Column Tag: Tools of the Trade

Satimage's Smile

by Tom Djajadiningrat

AppleScript IDE

Introduction

Smile is an AppleScript integrated development environment which is highly scriptable itself. It offers a fine text editor, pretty good documentation and the possibility to look up definitions from within the editor. But Smile's most amazing features are its ability to execute a script line-by-line from a seemingly ordinary text window and that its interface can be customized at will.

Since it is essentially free - all SatImage asks is your feedback to further improve Smile - it makes a great replacement for the standard Apple Script Editor. After a while you realize that Smile is much more than that. It brings together in a single application a combination of features which force you to rethink the possibilities of AppleScript.

Requirements

A Superior Editor

Despite its name, the editing features of Apple's Script Editor have always been somewhat poor. Especially its lack of drag-and drop and search-and-replace is rather annoying. Smile is worth getting just for these features. In addition, Smile features live scrolling, can compare files, has no 32k size limit, and implements Appearance. Command clicking the title bar of a window gives CodeWarrior-like access to its file's path (Figure 1). This in combination with support for Navigation Services makes organizing files much easier.


Figure 1. Smile provides easy access to a file's path.

If you are a keyboard animal then you will appreciate that keyboard navigation and selection are fully implemented. Jump word (option + left/right arrow key), jump start/end of line (command + left/right arrow key), page up/down (option + up/down arrow key) and home/end of document (command + up/down arrow key) and the selection equivalents with the shift key held down: it's all there.

Documentation

Smile comes with a guided tour in its own file format. It is clear and concise, taking about 10-15 minutes to work through. More elaborate documentation can be found within the Help menu. Smile's documentation makes use of Apple's Help Viewer and turns up as an option within the Help Center (Figure 2). If you get totally stuck with Smile you can subscribe to the Smile mailing list as described in the help.


Figure 2. Smile's help turns up in the Apple Help Center.

A Different Philosophy

If you like you can write scripts straight within a script window just as in the Script Editor. However, there is a far more powerful way to use Smile. Scripts can be written in a text window and a single line or piece of the code can be executed simply by selecting it and pressing enter (For those familiar with Mathematica this is somewhat similar to selecting cells and pressing enter after each one). This allows much flexibility during development as you can execute pieces of script in an order of your choosing. It also allows you to leave pieces of code hanging about without the need to comment them out. Once a script works to your satisfaction, you can copy it to a script window and save it in the usual variety of formats.

Apart from script windows and text windows Smile uses a worksheet and output windows, making four different types of window in total. Figure 3 shows all four at the same time. Let's have at each of them.

Worksheet

This is like a single page Scrapbook particular to Smile. Here you can store text and images which you use over and over again in different scripts, such as a copyright notice, those code samples you can never remember or logos. The result of executing a script in a script window is appended to the worksheet. The worksheet is saved automatically on quit and opened automatically when you start up Smile.

Text Window

During script development a text window is like a scratch pad. In a text window you can try out pieces of code in any order. You can have multiple text windows holding different versions of your code. When a piece of script in a text window is executed, the result shows up at the bottom of the same window. That is, unless you specify an...

Output Window

Selecting a text window and choosing Output window from the script menu creates a new window and redirects the output to that new window. You can also link an output window to a script window instead of to a text window. Then the output of the script window does not end up in the worksheet but in the output window.

Script Window

As mentioned before, you move your script to a script window once you wish to save it as an applet. The script window distinguishes itself visually by a comments area at the top, a coloured background, and a small toolbar at the bottom. Unlike a text window a script window does not allow execution of code line by line, it only allows you to run a whole script.


Figure 3. The four types of window in Smile: script window (top left), text window (top right), output window (bottom right) and worksheet (bottom left).

Decent Debugging

'Step-by-step' debugging

Let's go back to executing code in a text window. Putting the cursor on a line and pressing enter executes that line of code and advances the cursor to the start of the next line. So by pressing enter repeatedly you can step through the code. It even works properly with lines that are broken with option-return (¬). Note how we almost have step-by-step debugging here. Well, almost but not quite. You need to watch out for a few complications.

If you use a tell block to direct commands to a particular application you can't just step into the tell block: Smile will choke on the first line tell application "x" and display an error message (Figure 4). It does work if you select the whole tell block and press enter, but of course you loose resolution: if things go wrong you don't know which line within the block formed the culprit. Another option is to add tell application "x" to every line though this is a somewhat cumbersome solution.


Figure 4. Stepping into a tell block brings up an error message

This is where the tell command from the edit menu comes in (Figure 5). It lets you link a Smile text window to a particular application so that commands are directed at that application. Choosing the tell command makes a dialog box appear in which you can choose an application that is running on either the local or a remote machine (Figure 6). This turns on a small popup menu in the bottom left corner of a text window (Figure 7). Any script commands are now directed to the application you just linked to unless you speciÞcally ask them to be directed elsewhere. So you no longer need to wrap the commands for the linked app in a tell block or use a tell command on every line. Choosing logout from the popup menu breaks the link to the application (Figure 7).


Figure 5. Use the tell command to direct AppleScript commands to a particular applicaion.


Figure 6. Specify the application to link to. Here only the local host with its processes is shown.


Figure 7. The tell-related popup menu.

Variable watching

To further facilitate debugging Smile offers a variable watching window. After dragging or typing in a variable name in this window Smile will show its type and value during execution (Figure 8).


Figure 8. The variable watcher showing an integer, a real and a string.

Help with AppleScript Syntax

In addition to the open dictionary command familiar from Script Editor, Smile has got some extra features to help you with AppleScript syntax problems. First, you can select Find Definition from the Edit menu which will try to find the string in Smile's dictionary (or if you just linked to another app, that app's dictionary) or in a scripting addition. Second, if you need help with the AppleScript syntax of an application that you are linked to through the tell command you can choose Dictionary from the popup menu in the bottom left hand corner (Figure 7). I noticed that Smile chokes on the dictionary of Palm Desktop, while Script Editor has no problems with it. Finally, Smile's own dictionary is available under the Apple menu.

Advanced Stuff

Portability

Let's have a brief look at the somewhat more advanced stuff Smile has to offer. One nice feature is that it can assist you in writing portable code in which the normal English like AppleScript commands are replaced by raw codes. For example, if you want to script a particular application you may run into the problem that a particular user has a localized version of that app with a localized name (like SimpleText being called SimpelTekst in Dutch) or a version with a slightly different name (like BBEdit 5.x instead of 4.x). If you want the script to run smoothly and prevent a choose application dialog box from popping up you can look up the application by creator code instead of by name and resolve the name of the application at runtime. However, this means you cannot use the normal English-like commands as found in the app's dictionary, you will have to use the raw codes. If you first link to a particular application through the tell command you can then use the Copy Translate feature from the bottom left popup menu to change the selected text to raw codes (Figure 7).

Attachable and factored

Smile is not only scriptable and recordable, it also has those more rare AppleScript virtues: it is attachable, allowing scripts to be attached to its objects, and factored. What factored comes down to is that when the user chooses a certain command Smile sends an Apple event to itself instructing itself to execute the command rather than execute it directly. This ensures that Smile reacts in exactly the same way regardless of whether the Apple event originated from within or from outside Smile. This attachable and factored architecture is particularly powerful in combination with...

Custom interfaces

You can build your own custom interface for controlling Smile and AppleScripts. For example, you can add buttons to text windows to create so called Smile sheets and put up your own dialog boxes. Option-command clicking a button or dialolg opens the attached script. Pretty impressive stuff. Even the Variable Watcher is really a Smile sheet. When it comes to customization you are pretty much on your own though as the documentation concerning this feature is rather skimpy.

Interface Critique

Smile's interface could do with a little tidying up. Especially the script menu deserves some attention. At the moment it is a bit of a hodge-podge of all kinds of little tidbits provided by SatImage. As this is also the menu in which the user can place his own scripts, the structure of this menu can only get worse.

Then there is the linking of output windows to text or script windows. To me this seems a pretty essential component of the Smile philosophy, yet the command lives under the scripts menu. Since choosing output window essentially creates a special kind of text window the command would seem to be more at home under the file menu. I also found it a shame that the format of an output window is stubby and wide below the text window to which it is connected. The consequence is that any results quickly scroll out of view. I would prefer to have a tall and narrow output window, positioned to the side of the text window, so that older results remain visible and the most is made of the available screen real estate.

The Balance command's name does not do it justice. It suggests that the command is limited to indicating or closing unbalanced parentheses. However, it is in fact far more powerful than that. It can also suggest syntax, colourize indentation levels and assist you in writing tell statements, depending on what part of your script is selected before you activate it.

Finally, I find it a bit of a shame that a selection in a read-only document is not highlighted. The idea of having scripts embedded in read-only documents is quite tempting. It does not feel quite right though if you cannot see what you have selected before you press enter. Other applications, such as Tex-Edit Plus, do highlight selections within read-only documents.

More Information

While Smile seems to have gained quite a bit of momentum amongst hardcore AppleScript fans, it does not appear to be very well known among the Mac community at large. Here are some URLs to help you explore further:

Conclusion

They say you can't look a gift horse in the mouth but Smile easily stands up to scrutiny. Most of my gripes concern the interface which deserves some more attention. All in all this is a great addition to the AppleScript scene though. The editing features, powerful lookup functions, line-by-line execution and variable watching make Smile far superior to Apple's Script Editor. The idea of system wide control from scripts which happily live together with styled text and graphics in a single document is fascinating. More advanced scripters will appreciate the support for portable code, the possibilities to script Smile itself and the customizability of its interface through Smile sheets and dialogs. The nicest thing about Smile is probably its gradual but seemingly insaturable learning curve: it is easy to pick up but it is difficult to imagine exhausting its possibilities.


Since being involved in the re-design of the id-StudioLab web pages <http://www.io.tudelft.nl/id-studiolab/djajadiningrat/> Tom has got an even stronger opinion about layout and HTML. If you enjoy getting empty mail messages ask him for it with all four letter words left out at <J.P.Djajadiningrat@io.tudelft.nl>.

 

Community Search:
MacTech Search:

Software Updates via MacUpdate

Latest Forum Discussions

See All

Challenge those pesky wyverns to a dance...
After recently having you do battle against your foes by wildly flailing Hello Kitty and friends at them, GungHo Online has whipped out another surprising collaboration for Puzzle & Dragons. It is now time to beat your opponents by cha-cha... | Read more »
Pack a magnifying glass and practice you...
Somehow it has already been a year since Torchlight: Infinite launched, and XD Games is celebrating by blending in what sounds like a truly fantastic new update. Fans of Cthulhu rejoice, as Whispering Mist brings some horror elements, and tests... | Read more »
Summon your guild and prepare for war in...
Netmarble is making some pretty big moves with their latest update for Seven Knights Idle Adventure, with a bunch of interesting additions. Two new heroes enter the battle, there are events and bosses abound, and perhaps most interesting, a huge... | Read more »
Make the passage of time your plaything...
While some of us are still waiting for a chance to get our hands on Ash Prime - yes, don’t remind me I could currently buy him this month I’m barely hanging on - Digital Extremes has announced its next anticipated Prime Form for Warframe. Starting... | Read more »
If you can find it and fit through the d...
The holy trinity of amazing company names have come together, to release their equally amazing and adorable mobile game, Hamster Inn. Published by HyperBeard Games, and co-developed by Mum Not Proud and Little Sasquatch Studios, it's time to... | Read more »
Amikin Survival opens for pre-orders on...
Join me on the wonderful trip down the inspiration rabbit hole; much as Palworld seemingly “borrowed” many aspects from the hit Pokemon franchise, it is time for the heavily armed animal survival to also spawn some illegitimate children as Helio... | Read more »
PUBG Mobile teams up with global phenome...
Since launching in 2019, SpyxFamily has exploded to damn near catastrophic popularity, so it was only a matter of time before a mobile game snapped up a collaboration. Enter PUBG Mobile. Until May 12th, players will be able to collect a host of... | Read more »
Embark into the frozen tundra of certain...
Chucklefish, developers of hit action-adventure sandbox game Starbound and owner of one of the cutest logos in gaming, has released their roguelike deck-builder Wildfrost. Created alongside developers Gaziter and Deadpan Games, Wildfrost will... | Read more »
MoreFun Studios has announced Season 4,...
Tension has escalated in the ever-volatile world of Arena Breakout, as your old pal Randall Fisher and bosses Fred and Perrero continue to lob insults and explosives at each other, bringing us to a new phase of warfare. Season 4, Into The Fog of... | Read more »
Top Mobile Game Discounts
Every day, we pick out a curated list of the best mobile discounts on the App Store and post them here. This list won't be comprehensive, but it every game on it is recommended. Feel free to check out the coverage we did on them in the links below... | Read more »

Price Scanner via MacPrices.net

Free iPhone 15 plus Unlimited service for $60...
Boost Infinite, part of MVNO Boost Mobile using AT&T and T-Mobile’s networks, is offering a free 128GB iPhone 15 for $60 per month including their Unlimited service plan (30GB of premium data).... Read more
$300 off any new iPhone with service at Red P...
Red Pocket Mobile has new Apple iPhones on sale for $300 off MSRP when you switch and open up a new line of service. Red Pocket Mobile is a nationwide MVNO using all the major wireless carrier... Read more
Clearance 13-inch M1 MacBook Airs available a...
Apple has clearance 13″ M1 MacBook Airs, Certified Refurbished, available for $759 for 8-Core CPU/7-Core GPU/256GB models and $929 for 8-Core CPU/8-Core GPU/512GB models. Apple’s one-year warranty is... Read more
Updated Apple MacBook Price Trackers
Our Apple award-winning MacBook Price Trackers are continually updated with the latest information on prices, bundles, and availability for 16″ and 14″ MacBook Pros along with 13″ and 15″ MacBook... Read more
Every model of Apple’s 13-inch M3 MacBook Air...
Best Buy has Apple 13″ MacBook Airs with M3 CPUs in stock and on sale today for $100 off MSRP. Prices start at $999. Their prices are the lowest currently available for new 13″ M3 MacBook Airs among... Read more
Sunday Sale: Apple iPad Magic Keyboards for 1...
Walmart has Apple Magic Keyboards for 12.9″ iPad Pros, in Black, on sale for $150 off MSRP on their online store. Sale price for online orders only, in-store price may vary. Order online and choose... Read more
Apple Watch Ultra 2 now available at Apple fo...
Apple has, for the first time, begun offering Certified Refurbished Apple Watch Ultra 2 models in their online store for $679, or $120 off MSRP. Each Watch includes Apple’s standard one-year warranty... Read more
AT&T has the iPhone 14 on sale for only $...
AT&T has the 128GB Apple iPhone 14 available for only $5.99 per month for new and existing customers when you activate unlimited service and use AT&T’s 36 month installment plan. The fine... Read more
Amazon is offering a $100 discount on every M...
Amazon is offering a $100 instant discount on each configuration of Apple’s new 13″ M3 MacBook Air, in Midnight, this weekend. These are the lowest prices currently available for new 13″ M3 MacBook... Read more
You can save $300-$480 on a 14-inch M3 Pro/Ma...
Apple has 14″ M3 Pro and M3 Max MacBook Pros in stock today and available, Certified Refurbished, starting at $1699 and ranging up to $480 off MSRP. Each model features a new outer case, shipping is... Read more

Jobs Board

*Apple* Systems Administrator - JAMF - Activ...
…**Public Trust/Other Required:** None **Job Family:** Systems Administration **Skills:** Apple Platforms,Computer Servers,Jamf Pro **Experience:** 3 + years of Read more
IT Systems Engineer ( *Apple* Platforms) - S...
IT Systems Engineer ( Apple Platforms) at SpaceX Hawthorne, CA SpaceX was founded under the belief that a future where humanity is out exploring the stars is Read more
Nurse Anesthetist - *Apple* Hill Surgery Ce...
Nurse Anesthetist - Apple Hill Surgery Center Location: WellSpan Medical Group, York, PA Schedule: Full Time Sign-On Bonus Eligible Remote/Hybrid Regular Apply Now Read more
Housekeeper, *Apple* Valley Village - Cassi...
Apple Valley Village Health Care Center, a senior care campus, is hiring a Part-Time Housekeeper to join our team! We will train you for this position! In this role, Read more
Sublease Associate Optometrist- *Apple* Val...
Sublease Associate Optometrist- Apple Valley, CA- Target Optical Date: Apr 20, 2024 Brand: Target Optical Location: Apple Valley, CA, US, 92307 **Requisition Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.