sword in the stone   Hayne of Tintagel
Mac OS X  /  Programming  /  AppleScript Shell

AppleScript Shell

AppleScript is a very powerful scripting language available on all Macintosh computers. Usually, you write an applescript and then compile it, at which point it can be run like any other Mac application. In Mac OS X (which is Unix-based), it is possible to type commands in a Unix shell (e.g. bash). I was curious to see if I could make an "AppleScript shell" which would allow immediate execution of AppleScript commands. I implemented "ash" as a Perl script and it works quite well. I'm not sure whether anyone will find it useful - send me an email if you do.

download the "ash" script

You need Mac OS X to use it. After uncompressing it, save the file somewhere appropriate (I have it in a folder "Scripts" under my home folder which is in my PATH), make it executable, and then run it in the Terminal. When it is running, you will see the "ash>" prompt.
Type the command "-help" (without the quotes, but don't omit the initial dash ("-")) at the prompt to get more information about how to use it. (Here is the output of the "-help all" command if you want to read it now.)

You can also look at a PDF version of the man page for 'ash'.

Features

Perl techniques

The 'ash' Perl script is one of the longest and most complicated that I have written. It illustrates several techniques of Perl programming: