Apple introduced AppleScript very early as a language to automate the operating system and programs. Therefore, there is a considerable amount of information available on AppleScript, although much of it is a bit aged now.
Many people consider AppleScript to be a “simple” language
that is “easy to learn”. While it may look like this on the
surface, I disagree with this assessment. AppleScript is
verbose and requires a lot of typing. It is
easy to understand for native English speakers because it
uses simple English sentences like
set this to that or
get the first item of (records as list). This may
seem obvious to native speakers, but it is more difficult for speakers of other languages since
the vocabulary is vast and sometimes obscure.
Furthermore, Apple stopped the development of its scripting language long ago. It is sorely missing basic string functions, regular expressions, array methods, and so on.
point of being unintelligible. It provides all the
functions one would expect of a modern programming language.
this=that to set a value and
list to get the
first element of a list. The vocabulary is limited, and
every browser today and on the desktop (in the form
of npm). It is used by far more people, in far more
projects, and on far more projects than AppleScript.
But almost all problems can be solved in any programming language. So if you prefer AppleScript, stick with it, by all means.
Short History #
Structure of this site #
You should read the following chapters before diving into scripting proper:
- Introduction to JXA gives you a short overview of the main tools and techniques to write, run and debug JXA scripts
- Basics introduces some recurring concepts that you’ll need in most of your scripts.
- A first example shows a simple example of a JXA script.
- Working with Objects explains the general approach to handle objects in JXA, how to use their properties etc.
- Working with Apps explains how to work with applications, in particular how to get information about their properties, elements and methods.
After that, you may head over to Automating Applications. There you’ll find more in-depth examples for working with different programs like Mail, Notes, Contacts, and others.
Whenever you see an underlined reference to a code line, you will see the line highlighted in the corresponding code block when you mouse over it.