AppleScript is a language that predates the Mac as we know it today, originating in 1993. While other scripting languages have more fully featured libraries and more robust syntax, the power of AppleScript is for automating Mac applications.
Any Mac application can include a scripting dictionary, and many that ship with macOS do. A scripting dictionary lets scripts know what items the app contains, and what actions can be performed.
A script can then use that information to automate repetitive tasks, and to form a "glue" between different apps, forming fully customizable workflows.
|Version||OS Release||Release Date|
The power of AppleScript lies in being able to automate many Mac applications. To find out what you can automate, you need to read an app's scripting dictionary.
To do so, launch Script Editor, and select File > Open Dictionary…
Once you choose an app, its dictionary will open up in a new window. At the top of the window, you'll see a column view (like Finder's). The first column contains various "suites" of AppleScript terminology. The "Standard Suite" contains items that apply to most apps (e.g.
With Mac OS X Leopard and earlier, and OS X Yosemite and later, Script Editor is located at
Between Mac OS X Snow Leopard and OS X Mavericks inclusive, Script Editor is AppleScript Editor.
Enter the following line of code:
display dialog "Hello World"
Click the run button.
Two things happen: Script Editor compiles your script (if there are any errors, it'll let you know what's wrong and where), and then runs it.
You will now be shown a dialog saying "Hello World".
You've completed your first script!
display dialog is one command, though it uses two words. This is common in AppleScript, unlike other languages which commonly require joining words together with no spaces. The
display dialog command tells AppleScript to display a pop-up dialog.
This last part in "double quotes" tells the script what text to display.