REFERENCES FOR LEARNING & USING APPLESCRIPT Modified: 2018/06/19 18:47
AppleScript is a rather peculiar scripting language to learn.
Its so-called natural language syntax is loved by some and hated by others.
It has a relatively small core language, but many if not most scriptable applications have terminology and syntax unique to that app. This means you have to be willing to learn the quirks of every new app you work with.
You can become an absolute expert at scripting BBEdit and not understand much about scripting Capture One.
Fortunately many apps have similar ways of doing things, so the more you learn the more intuitively you can puzzle out idiosyncrasies in new apps. Nevertheless it's a good idea to reach out for help if you've been beating your head against the wall for more than an hour or two. Dain brammage isn't of much use to anyone.
Despite AppleScript's quirks it is an enormous productivity enhancer for me.
When it debuted in 1993 I thought it was junk, but a year or two later an OSAX (library) came out that added regular expression support to AppleScript. That simple addition plus the productivity utilities I already had like QuicKeys and KeyQuencer allowed me to rapidly process text and do many other things most Mac-users never even thought of, so I was off to the races.
ONLINE APPLESCRIPT COMMUNITIES
The Applescript Users List
APPLESCRIPT & MAC AUTOMATION WEBSITES
Published personally by Sal Soghoian — a long-time Apple employee and AppleScript Maven.
Doug’s Applescripts for iTunes
455 (and counting) AppleScripts for Apple's iTunes that will help make managing your digital music collection easier and more fun!
Applescript For Absolute Starters
A very, very basic tutorial. It's old but still pretty relevant.
OFFICIAL APPLESCRIPT DOCUMENTATION — THE APPLESCRIPT LANGUAGE GUIDE
If you're going to work with Applescript you need access to The Applescript Language Guide.
It is a syntax reference and not a tutorial.
Apple quite shamefully has stopped producing PDF verions of the ASLG, but the 2013 version (for 10.9.x) is still available. Download it, so you have a local searchable copy. It won't be complete, but it's still a handy reference.
Online Version (up-to-date):
APPLESCRIPT BOOKS I RECOMMEND
NOTE: Trying to learn Applescript without buying at least one good reference is a fool's errand.
Learn AppleScript: The Comprehensive Guide to Scripting and Automation on Mac OS X by Hamish Sanderson & Hanaan Rosenthal
AppleScript: The Definitive Guide, 2nd Edition by Matt Neuburg
APPLESCRIPT BOOKS I HAVE NOT EVALUATED
AppleScript 1-2-3: A Self-Paced Guide to Learning AppleScript (Apple Pro Training Series) by Sal Soghoian and Bill Cheeseman
AppleScript: A Beginner's Guide by Guy Hart-Davis
ESSENTIAL AUTOMATION UTILITIES
NOTE: If you have Keyboard Maestro you really don't need FastScripts, however I like how FS' UI works — so I use both utilities on my system.
FastScripts — $9.95 U.S.
FastScripts is an enhanced replacement for Apple's own AppleScript menu.
It provides many usability improvements, a refined UI, Global & App-Specific Keyboard Shortcuts. It is scripting language agnostic and handles AppleScript, Perl, any language recognized by the shell, Automator workflows — even applications or documents.
I've used it since 2003.
Keyboard Maestro — $36.00 U.S.
Keyboard Maestro goes far beyond running AppleScripts
Whether you are a power user or a grandparent (or both!), your time is precious. So why waste it when Keyboard Maestro can help improve almost every aspect of using your Mac. Even the simplest things, like typing your email address, or going to Gmail or Facebook, launching Pages, or duplicating a line, all take time and add frustration.
I've used the OSX version since 2003 (and used the old Mac OS version for many years before that).
Script Editor — Apple software pre-installed on OSX (called Applescript Editor on some Oses)
The Apple-Provided 'Script Editor' (pre-Snow Leopard) and 'Applescript Editor' (Snow Leopard & Lion) is not a bad editor and provides searchable access to application dictionaries. (It has been renamed to 'Script Editor' again in Yosemite.)
Script Debugger — $99.00 U.S.
When I began scripting Apple's Script Editor didn't even have find/replace. After some months of fighting with it I gave up and spent $129.95 (in 1995) on Script Debugger v1.0 after evaluating both it and Scripter.
You wouldn't believe how much aggravation that purchase (and upgrades) has saved me.
Smile — freeware
A powerful and useful Applescript Development Environment. Using a Terminal window you can step through scripts line-by-line. Although this is not as convenient as in Script Debugger it's better than the Applescript Editor can do.
Smile can create custom dialogs, open web pages and process them, create scientific graphs, and many other things.
A small excerpt:
• Extract data from files (default data formats supported: text, binary, FITS, XNF, ...), • Perform data processing using commands provided with Smile or controlling external code • Visualize your data in the most usual forms (curves, scatter plots, bar graphs, contour lines, color maps and vector fields in 2D, and 3D surfaces) • Customize the interaction of the user with the plots (handling mouse clicks, contextual menus, keyboard events...) and create custom interfaces • Export your plot as a PDF file, as a bitmap picture (PNG, JPEG, TIFF, BMP, PSD) or as a QuickTime movie.
Full feature list:
I do primary development with Script Debugger, but I always keep Smile on my system for testing and other jobs.
OSAXEN I RECOMMEND
An OSAX or Open Scripting Architecture Extension is a library that adds features to AppleScript.
The Satimage.osax from Satimage is a companion to the Smile AppleScript Editor, but it is available as a stand-alone component.
There are several more available on this page, but the one I MUST have on my system is the Satimage.osax.
It adds regular expression support and many other useful features to AppleScript.
SCRIPTABLE PLAIN-TEXT EDITORS
BBEdit — $49.95 U.S.
Programming & HTML Editor Extraordinaire.
TextWrangler — freeware
If you work with plain text documents and don't own BBEdit do yourself a favor and install it.
SCRIPTABLE STYLED-TEXT EDITORS
Tex-Edit Plus — $15.00 U.S.
A highly scriptable styled-text editor and very useful for learning Applescript. The unregistered version is not crippled in any way.
Jedit X — $28.00 U.S.
A Cocoa text editor — yet another super TextEdit for plain and rich text.
Far more scriptable than TextEdit.
USEFUL APPLESCRIPT TOOLS
AppleScriptObjC Explorer — $49.95 U.S.
A script editor that takes advantage of AppleScript's ability to call Cocoa methods in OS X 10.6 and later.
UI Browser — $55.00
A utility for exploring AppleScript GUI Scripting and Accessibility technologies.
The price seems a litte steep, but if you need to develop scripts using System Events and GUI-Scripting this vital tool will keep you from pulling your hair out.
Brings AppleScript "Attachability" to all OSX Applications
Attach a UI Action script to any standard native Mac OS X application, and UI Actions automatically runs the script whenever you perform specified user actions in the target application. You write the script, and you select the user action that triggers it, such as choosing a menu item, changing the value of a text field, opening a drawer or window, or activating an application.
Platypus — freeware
A developer tool that can be used to create native, flawlessly integrated Mac OS X applications from interpreted scripts such as shell scripts or Perl and Python programs.
Myriad Helpers — freeware
A collection of Objective-C files that simplify some of the coding involved in AppleScriptObjC.
EventScripts — $3.99 U.S. — App-Store
A simple application for triggering AppleScripts or shell scripts whenever certain events occur.
JSONhelper — freeware — App-Store
Location Helper — freeware — App-Store
Brings the power of Core Location to AppleScript