Recently I’ve been working on redesigning our Mac campus printing app which is written in AppleScript Objective-C. This year I’m making it dynamic so that I don’t have to re-release the application throughout the semester just to add new printers. The application fetches three plists from a campus web server. The first one contains a list of academic printers, the second contains a list of administrative printers, and the third contains a list of printer drivers required for the printers. The printer plists are used to populate a table that allows the end users to select which printers they’d like to install. The printer drivers plist contains an array of printer drivers, each contained within its own dict containing several keys, as shown below:

The application loops through each dict in the plist and downloads, verifies, and installs the printer drivers as necessary. The Macs that are managed in our fleet already have the appropriate drivers, but because students use this application too, it’s important that we verify they have the correct drivers installed. I wanted the application to display a download progress screen for each download, as well as an installer screen similar to Apple’s Installer GUI. Both are shown below.

To achieve this, I had to parse the output files of both curl and installer. curl outputs to stderr and its output is surprisingly difficult to parse. Peter Bukowinski of HHMI assisted me in the trial and error necessary to finally get it right (thanks, Peter!). installer’s output is very verbose, but is fairly easy to parse. Below are modified snippets of the AppleScript I’m using to parse curl and installer. Hopefully they’re helpful to some people.