How do I learn AppleScript?

How do I learn AppleScript?

Before we get to how to learn Applescript, it’s important to first think about WHY you would want to learn it. Based on my experience, here’s my take on that.

  • Applescript’s main reason-to-be is to send or receive data directly between applications and also control them. This is something unique that it does, so if this is what you want to do, Applescript may be what you need.
  • I do like Applescript, but I wouldn’t recommend it as a general purpose scripting language. It can be slow and cumbersome and the syntax is unusual. Scripts are harder to share because most people use languages like python. Also, it can be a better use of your time to learn something that is more broadly useful.
  • Some people say that Applescript is a good way to dabble in scripting and programming before moving to other languages. I encourage people (on Apple platforms) to look at Swift instead. It can be used for short scripts on up to large programs.
  • If you have specific applications in mind that you want to control or exchange data with, be sure to check their scripting dictionary first as they may not support Applescript or the functionality you are looking for. Pro Tip: Drop any application on the Script Editor icon to reveal the dictionary.

With these in mind, how do you learn AppleScript? It’ll take some investment. Here is Apple’s canonical guide, which is grossly out of date but still useful:

AppleScript Language Guide

However! I’ve recently found an EXCELLENT resource that is far better than the language guide, especially for beginners. It’s a free book available in iBooks:

Basics of AppleScript

There are also lots of sample scripts, which always helps when learning a new language. It’ll also help you figure out if the kinds of things you can do in AppleScript are worth the effort in learning it.

Having said all this, I’ve been using AppleScript for over 20 years. There are times when it’s really the only way to do something in particular. I used to write all scripts in AppleScript but since then I typically use Swift.