AppleScript is the only language I’ve ever used that I’d describe as a read-only language (the opposite of Perl, for example). I’ve never come across an AppleScript script that I couldn’t understand from a quick skim but writing them is something I’ve always struggled with. The scoping rules (which dictionary will actually provide the implementation of a word) are confusing.
There are some really nice features in the AppleScript’s interface in the frameworks. The idea of exposing operations on models to scripting is very simple and powerful but I’m not aware of anything prior to AppleScript that did this. Windows 3.0 had a Recorder app that let you capture the input events sent to the system and replay them. This was really fun when you were opening new windows because each window was moved down and to the right from the previous one and so your Recorder events would be up and to the left of the UI widgets in the new window.
To my mind, this is the biggest contribution of AppleScript and the retrospective talks about it a lot. Almost every macOS app exposes scripting functions. These days, you can use them directly from JavaScript instead of AppleScript (OS X shipped with a framework for plugging in alternative scripting language implementations and I heard about a couple of third-party ones but never used them). This is an incredibly powerful. I’ve used it to export an OmniOutliner outline as a directory structure full of .tex files with the outline contents, as a way of integrating OmniGraffle export into Makefiles (so if I edited a file in the GUI, the Makefile would ask the GUI to export as PDF for pdflatex to consume) and a load of other things. I think automation is supposed to do the same thing on iOS but I’ve never used it.
One of the things I really like about macOS is that features like this are integrated with the UNIX underpinnings. Just as you can use pbpaste / pbcopy to get rich interaction with the pasteboard, you can use osascript to invoke AppleScript scripts from shell scripts (you can run commands from AppleScript as well, or you can tell Terminal.app to do things). This lets you do things like write a shell script that grabs something from the pasteboard, filters it through some command-line applications, puts it back on the pasteboard in the new format, then tells a GUI application to do something with it.
The biggest problem with the AppleScript model was the lack of atomicity. This was fine on classic MacOS, where you had cooperative multitasking and so the app that you’re controlling would run a script command, yield, and transfer control back to the command interpreter. It’s not great on a multicore system with a kernel that does preemptive multitasking because state can change out from under you. For example, a load of the Mail.app scripting things are really dangerous because you query the mailbox state and then do something with it, but the mailbox state can be changed in between and there’s no way of building any kind of transaction.
I worked with William from 1991 to 1993. He was such a genuinely nice man, warm and friendly, and a sharp dresser. He always looked like he could have stepped out of an E.M. Forster novel. (In fact the entire AppleScript team was so gosh-darn nice, at least in rosy hindsight. One of the best groups of people I ever worked with.)
He was also, of course, brilliant. He designed the AppleScript language and compiler, and while I think AppleScript is terribly flawed, it’s amazing that he made it work given the design constraints (“it has to be like HyperTalk”) and the goal of integrating syntax from arbitrary applications and being able to reconfigure to multiple natural languages including Japanese.
William reached out to me, out of the blue, 10ish years ago, when I organized a papers reading group and he asked what we thought of the paper! It was quite the surprise, but it was quite interesting to see someone care about and seek feedback / offer to answer questions about it.
I didn’t know him beyond that, but seems we lost another great one. :(
In my early days learning computer programming, Applescript was just about the only language where I could guess at the syntax and actually get it right a lot of the time just based on natural-language intuition. I haven’t seen a language that gets that right before or since. Rest in peace.
His AppleScript paper is a favorite of mine.
RIP to a fellow computer scientist and Austinite.
AppleScript is the only language I’ve ever used that I’d describe as a read-only language (the opposite of Perl, for example). I’ve never come across an AppleScript script that I couldn’t understand from a quick skim but writing them is something I’ve always struggled with. The scoping rules (which dictionary will actually provide the implementation of a word) are confusing.
There are some really nice features in the AppleScript’s interface in the frameworks. The idea of exposing operations on models to scripting is very simple and powerful but I’m not aware of anything prior to AppleScript that did this. Windows 3.0 had a Recorder app that let you capture the input events sent to the system and replay them. This was really fun when you were opening new windows because each window was moved down and to the right from the previous one and so your Recorder events would be up and to the left of the UI widgets in the new window.
To my mind, this is the biggest contribution of AppleScript and the retrospective talks about it a lot. Almost every macOS app exposes scripting functions. These days, you can use them directly from JavaScript instead of AppleScript (OS X shipped with a framework for plugging in alternative scripting language implementations and I heard about a couple of third-party ones but never used them). This is an incredibly powerful. I’ve used it to export an OmniOutliner outline as a directory structure full of .tex files with the outline contents, as a way of integrating OmniGraffle export into
Makefile
s (so if I edited a file in the GUI, the Makefile would ask the GUI to export as PDF forpdflatex
to consume) and a load of other things. I think automation is supposed to do the same thing on iOS but I’ve never used it.One of the things I really like about macOS is that features like this are integrated with the UNIX underpinnings. Just as you can use
pbpaste
/pbcopy
to get rich interaction with the pasteboard, you can useosascript
to invoke AppleScript scripts from shell scripts (you can run commands from AppleScript as well, or you can tell Terminal.app to do things). This lets you do things like write a shell script that grabs something from the pasteboard, filters it through some command-line applications, puts it back on the pasteboard in the new format, then tells a GUI application to do something with it.The biggest problem with the AppleScript model was the lack of atomicity. This was fine on classic MacOS, where you had cooperative multitasking and so the app that you’re controlling would run a script command, yield, and transfer control back to the command interpreter. It’s not great on a multicore system with a kernel that does preemptive multitasking because state can change out from under you. For example, a load of the Mail.app scripting things are really dangerous because you query the mailbox state and then do something with it, but the mailbox state can be changed in between and there’s no way of building any kind of transaction.
I worked with William from 1991 to 1993. He was such a genuinely nice man, warm and friendly, and a sharp dresser. He always looked like he could have stepped out of an E.M. Forster novel. (In fact the entire AppleScript team was so gosh-darn nice, at least in rosy hindsight. One of the best groups of people I ever worked with.)
He was also, of course, brilliant. He designed the AppleScript language and compiler, and while I think AppleScript is terribly flawed, it’s amazing that he made it work given the design constraints (“it has to be like HyperTalk”) and the goal of integrating syntax from arbitrary applications and being able to reconfigure to multiple natural languages including Japanese.
William reached out to me, out of the blue, 10ish years ago, when I organized a papers reading group and he asked what we thought of the paper! It was quite the surprise, but it was quite interesting to see someone care about and seek feedback / offer to answer questions about it.
I didn’t know him beyond that, but seems we lost another great one. :(
In my early days learning computer programming, Applescript was just about the only language where I could guess at the syntax and actually get it right a lot of the time just based on natural-language intuition. I haven’t seen a language that gets that right before or since. Rest in peace.