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

Whitethorn Games combines two completely...
If you have ever gone fishing then you know that it is a lesson in patience, sitting around waiting for a bite that may never come. Well, that's because you have been doing it wrong, since as Whitehorn Games now demonstrates in new release Skate... | Read more »
Call of Duty Warzone is a Waiting Simula...
It's always fun when a splashy multiplayer game comes to mobile because they are few and far between, so I was excited to see the notification about Call of Duty: Warzone Mobile (finally) launching last week and wanted to try it out. As someone who... | Read more »
Albion Online introduces some massive ne...
Sandbox Interactive has announced an upcoming update to its flagship MMORPG Albion Online, containing massive updates to its existing guild Vs guild systems. Someone clearly rewatched the Helms Deep battle in Lord of the Rings and spent the next... | Read more »
Chucklefish announces launch date of the...
Chucklefish, the indie London-based team we probably all know from developing Terraria or their stint publishing Stardew Valley, has revealed the mobile release date for roguelike deck-builder Wildfrost. Developed by Gaziter and Deadpan Games, the... | Read more »
Netmarble opens pre-registration for act...
It has been close to three years since Netmarble announced they would be adapting the smash series Solo Leveling into a video game, and at last, they have announced the opening of pre-orders for Solo Leveling: Arise. [Read more] | Read more »
PUBG Mobile celebrates sixth anniversary...
For the past six years, PUBG Mobile has been one of the most popular shooters you can play in the palm of your hand, and Krafton is celebrating this milestone and many years of ups by teaming up with hit music man JVKE to create a special song for... | Read more »
ASTRA: Knights of Veda refuse to pump th...
In perhaps the most recent example of being incredibly eager, ASTRA: Knights of Veda has dropped its second collaboration with South Korean boyband Seventeen, named so as it consists of exactly thirteen members and a video collaboration with Lee... | Read more »
Collect all your cats and caterpillars a...
If you are growing tired of trying to build a town with your phone by using it as a tiny, ineffectual shover then fear no longer, as Independent Arts Software has announced the upcoming release of Construction Simulator 4, from the critically... | Read more »
Backbone complete its lineup of 2nd Gene...
With all the ports of big AAA games that have been coming to mobile, it is becoming more convenient than ever to own a good controller, and to help with this Backbone has announced the completion of their 2nd generation product lineup with their... | Read more »
Zenless Zone Zero opens entries for its...
miHoYo, aka HoYoverse, has become such a big name in mobile gaming that it's hard to believe that arguably their flagship title, Genshin Impact, is only three and a half years old. Now, they continue the road to the next title in their world, with... | Read more »

Price Scanner via MacPrices.net

B&H has Apple’s 13-inch M2 MacBook Airs o...
B&H Photo has 13″ MacBook Airs with M2 CPUs and 256GB of storage in stock and on sale for up to $150 off Apple’s new MSRP, starting at only $849. Free 1-2 day delivery is available to most US... Read more
M2 Mac minis on sale for $100-$200 off MSRP,...
B&H Photo has Apple’s M2-powered Mac minis back in stock and on sale today for $100-$200 off MSRP. Free 1-2 day shipping is available for most US addresses: – Mac mini M2/256GB SSD: $499, save $... Read more
Mac Studios with M2 Max and M2 Ultra CPUs on...
B&H Photo has standard-configuration Mac Studios with Apple’s M2 Max & Ultra CPUs in stock today and on Easter sale for $200 off MSRP. Their prices are the lowest available for these models... Read more
Deal Alert! B&H Photo has Apple’s 14-inch...
B&H Photo has new Gray and Black 14″ M3, M3 Pro, and M3 Max MacBook Pros on sale for $200-$300 off MSRP, starting at only $1399. B&H offers free 1-2 day delivery to most US addresses: – 14″ 8... Read more
Department Of Justice Sets Sights On Apple In...
NEWS – The ball has finally dropped on the big Apple. The ball (metaphorically speaking) — an antitrust lawsuit filed in the U.S. on March 21 by the Department of Justice (DOJ) — came down following... Read more
New 13-inch M3 MacBook Air on sale for $999,...
Amazon has Apple’s new 13″ M3 MacBook Air on sale for $100 off MSRP for the first time, now just $999 shipped. Shipping is free: – 13″ MacBook Air (8GB RAM/256GB SSD/Space Gray): $999 $100 off MSRP... Read more
Amazon has Apple’s 9th-generation WiFi iPads...
Amazon has Apple’s 9th generation 10.2″ WiFi iPads on sale for $80-$100 off MSRP, starting only $249. Their prices are the lowest available for new iPads anywhere: – 10″ 64GB WiFi iPad (Space Gray or... Read more
Discounted 14-inch M3 MacBook Pros with 16GB...
Apple retailer Expercom has 14″ MacBook Pros with M3 CPUs and 16GB of standard memory discounted by up to $120 off Apple’s MSRP: – 14″ M3 MacBook Pro (16GB RAM/256GB SSD): $1691.06 $108 off MSRP – 14... Read more
Clearance 15-inch M2 MacBook Airs on sale for...
B&H Photo has Apple’s 15″ MacBook Airs with M2 CPUs (8GB RAM/256GB SSD) in stock today and on clearance sale for $999 in all four colors. Free 1-2 delivery is available to most US addresses.... Read more
Clearance 13-inch M1 MacBook Airs drop to onl...
B&H has Apple’s base 13″ M1 MacBook Air (Space Gray, Silver, & Gold) in stock and on clearance sale today for $300 off MSRP, only $699. Free 1-2 day shipping is available to most addresses in... Read more

Jobs Board

Medical Assistant - Surgical Oncology- *Apple...
Medical Assistant - Surgical Oncology- Apple Hill Location: WellSpan Medical Group, York, PA Schedule: Full Time Sign-On Bonus Eligible Remote/Hybrid Regular Apply Read more
Omnichannel Associate - *Apple* Blossom Mal...
Omnichannel Associate - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Read more
Cashier - *Apple* Blossom Mall - JCPenney (...
Cashier - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Blossom Mall Read more
Operations Associate - *Apple* Blossom Mall...
Operations Associate - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Read more
Business Analyst | *Apple* Pay - Banco Popu...
Business Analyst | Apple PayApply now " Apply now + Apply Now + Start applying with LinkedIn Start + Please wait Date:Mar 19, 2024 Location: San Juan-Cupey, PR Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.