VivaLaData
home
about
clients
contact
resource
chocolate
index
Process Automation & Batch Processing with Scripts
Last Modified 1/12/2002.

Almost any repetitive process can be automated on the Mac with scripts. There are three main scripting languages for Macintosh: Frontier, Applescript, and RealBasic. With these languages, you can send apple events to interact with any scriptable program on the Mac. You can trigger these automated processes to perform on a regular basis using a variety of Cron utilities. If you go to the Version Tracker site and type "Cron" into the search blank, you'll get back several suggestions for Cron utilities, but my favorite is iDo Script Scheduler put out by Sophisticated Circuits. Their free version works just fine for most purposes. If you're running MacOS 8.5 or greater, you can trigger applescripts automatically with folder actions, but the folder window needs to be open for this to work.

Another handy way to trigger scripts is through the OSA Menu. I've written a couple items for the OSA Menu that work with Eudora. One of the scripts imports an email into a Filemaker Pro database and the other renders the text in Microsoft Internet Explorer.

Frontier is a programming environment based on a database structure. It's cross-platform, although it can only send apple events on the Mac. Besides it's ability to manipulate scriptable applications, it also has a built-in Cron utility. Before you can script an application with Frontier, you need to have the glue for that application in the system. Here is my most recent glue recipe:

Choose Commercial Developers from the UserLand Suites sub-menu of the Suites menu. The Glue menu appears in Frontier's menu bar. Choose Enter Your App's Name from the Glue menu. A series of dialogs guide you thru the process of setting up Frontier to work with your application. Open your glue table. From the Glue menu, choose the Open Table & Menu command. It opens your app's table and shared menu.

Frontier will then ask you: "Use the application's aete resources to create the glue?"

Answer "yes" and your glue will be created.

I have created glue for MacAuthorize, MondoMail and Panorama. They also include a few simple examples to get you started with scripting the application.

Frontier's biggest advantage over applescript is that it's multi-threaded. Multi-threaded means it can handle more than one request at a time, but as a developer, you have to code for that. You have to know how to manage your threads. That involves semaphores.

Applescript used to be markedly slower than Frontier, although since it's native in Mac OS 8.5, it's catching up. It's still not multi-threaded meaning it can't handle more than one request at a time. That is not as much of a concern with batch processing and automation programs as it is with web cgis. FaceSpan allows developers to add a fairly elaborate user interface to their scripts. Filemaker can also contain applescripts. Because of it's other programming features and the fact that it's a database, I prefer Filemaker when I need a complex interface for an applescript. If you're looking for scripting additions to expand the functionality of your scripts, check out the list of scripting additions maintained at MacScripter.net.

RealBasic is the newest development environment that can send apple events. RealBasic syntax is the same as Visual Basic, but it's not cross-platform. I've found RealBasic to be inferior to Applescript and Frontier in receiving apple event responses. To be specific, I tried to redo my username and password management cgis in RealBasic and it didn't work because RealBasic couldn't tell me when WebStar failed to add the new password. I have not explored how RealBasic performs with apple event responses from Filemaker and other scriptable applications. I assume it's not as bad since I've heard people talking about using it successfully with Filemaker.

I wrote a conversion program a few years back that converted folders full of Mac files to PC files. Anyone looking for that program should check out NameCleaner by Sig Software. Emailer2Eudora is an applescript I wrote that converts Emailer address books to Eudora address books. This download includes a version that works for groups.

My most recent release is an editable applescript that will download email from Outlook to Filemaker. Comments are included at the top of the editable script. Just open it up with the script editor. You can download this script here.

Back to the Top