Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save galdiolo/a249a14829cebafec9b26db064421393 to your computer and use it in GitHub Desktop.
Save galdiolo/a249a14829cebafec9b26db064421393 to your computer and use it in GitHub Desktop.
References For Learning & Using Applescript
-------------------------------------------------------------------------------------------
REFERENCES FOR LEARNING & USING APPLESCRIPT Modified: 2016/05/25 15:01
-------------------------------------------------------------------------------------------
NOTES
-------------------------------------------------------------------------------------------
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
http://lists.apple.com/mailman/listinfo/applescript-users
MacScripter.net
http://macscripter.net
-------------------------------------------------------------------------------------------
APPLESCRIPT & MAC AUTOMATION WEBSITES
-------------------------------------------------------------------------------------------
MacOSXAutomation.com
-------------------------------------------------------------------------------------------
Published personally by Sal Soghoian — a long-time Apple employee and AppleScript Maven.
http://macosxautomation.com
-------------------------------------------------------------------------------------------
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!
http://dougscripts.com/itunes/
-------------------------------------------------------------------------------------------
APPLESCRIPT TUTORIALS
-------------------------------------------------------------------------------------------
Applescript For Absolute Starters
-------------------------------------------------------------------------------------------
A very, very basic tutorial. It's old but still pretty relevant.
http://files.macscripter.net/sourcebook/AS4ASb2.pdf
-------------------------------------------------------------------------------------------
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.
Downloadable PDF:
https://applescriptlibrary.files.wordpress.com/2013/11/applescriptlanguageguide-2013.pdf
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):
http://developer.apple.com/library/mac/#documentation/AppleScript/Conceptual/AppleScriptLangGuide/introduction/ASLR_intro.html
-------------------------------------------------------------------------------------------
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
-------------------------------------------------------------------------------------------
http://www.google.com/search?btnI=I%27m+Feeling+Lucky&ie=UTF-8&oe=UTF-8&q=amazon.com+ISBN-13%3A+978-1430223610
-------------------------------------------------------------------------------------------
AppleScript: The Definitive Guide, 2nd Edition
by Matt Neuburg
-------------------------------------------------------------------------------------------
http://www.google.com/search?btnI=I%27m+Feeling+Lucky&ie=UTF-8&oe=UTF-8&q=amazon.com+ISBN-13%3A+978-0596102111
-------------------------------------------------------------------------------------------
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
-------------------------------------------------------------------------------------------
http://www.google.com/search?btnI=I%27m+Feeling+Lucky&ie=UTF-8&oe=UTF-8&q=amazon.com+ISBN-13%3A+978-0321149312
-------------------------------------------------------------------------------------------
AppleScript: A Beginner's Guide
by Guy Hart-Davis
-------------------------------------------------------------------------------------------
http://www.google.com/search?btnI=I%27m+Feeling+Lucky&ie=UTF-8&oe=UTF-8&q=amazon.com+ISBN-13%3A+978-0071639545
-------------------------------------------------------------------------------------------
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.
https://red-sweater.com/fastscripts/
-------------------------------------------------------------------------------------------
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).
http://www.keyboardmaestro.com/main/
-------------------------------------------------------------------------------------------
APPLESCRIPT EDITORS
-------------------------------------------------------------------------------------------
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 — $199.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.
http://www.latenightsw.com
-------------------------------------------------------------------------------------------
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:
http://www.satimage.fr/software/en/smilelab/gallery/smile_features.html
Downloads:
http://www.satimage.fr/software/en/downloads/index.html
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.
http://www.satimage.fr/software/en/downloads/downloads_companion_osaxen.html
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.
Mightily Scriptable.
http://www.barebones.com/products/bbedit/
-------------------------------------------------------------------------------------------
TextWrangler — freeware
-------------------------------------------------------------------------------------------
If you work with plain text documents and don't own BBEdit do yourself a favor and install
it.
http://www.barebones.com/products/textwrangler/index.html
-------------------------------------------------------------------------------------------
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.
http://www.tex-edit.com/
-------------------------------------------------------------------------------------------
Jedit X — $28.00 U.S.
-------------------------------------------------------------------------------------------
A Cocoa text editor — yet another super TextEdit for plain and rich text.
Far more scriptable than TextEdit.
http://www.artman21.com/en/jedit_x/
-------------------------------------------------------------------------------------------
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.
http://www.macosxautomation.com/applescript/apps/explorer.html
-------------------------------------------------------------------------------------------
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.
http://pfiddlesoft.com/uibrowser/
-------------------------------------------------------------------------------------------
UI Actions
-------------------------------------------------------------------------------------------
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.
http://www.sveinbjorn.org/platypus
-------------------------------------------------------------------------------------------
Myriad Helpers — freeware
-------------------------------------------------------------------------------------------
A collection of Objective-C files that simplify some of the coding involved in
AppleScriptObjC.
http://www.macosxautomation.com/applescript/apps/helpers.html
-------------------------------------------------------------------------------------------
EventScripts — $3.99 U.S. — App-Store
-------------------------------------------------------------------------------------------
A simple application for triggering AppleScripts or shell scripts whenever certain events
occur.
http://mousedown.net/mouseware/EventScripts.html
-------------------------------------------------------------------------------------------
JSONhelper — freeware — App-Store
-------------------------------------------------------------------------------------------
An small utility application which allows you to do useful things with JSON (JavaScript
Object Notation) directly from AppleScript.
https://itunes.apple.com/us/app/json-helper-for-applescript/id453114608
-------------------------------------------------------------------------------------------
Location Helper — freeware — App-Store
-------------------------------------------------------------------------------------------
https://itunes.apple.com/us/app/location-helper-for-applescript/id488536386
Brings the power of Core Location to AppleScript
-------------------------------------------------------------------------------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment