AppleScript Programming/Introduction

AppleScript is an object-oriented scripting language, spesifically designed to work with inter-application communication facilitating Apple Events. An object is an instance of a predefined class with shared characteristics.

The objects one may work with using the AppleScript language may be defined within three different sources: Within the AppleScript Language itself, within macOS scriptable applications, or within third party applications. All classes and commands from these sources should be documented in the Scripting dictionaries available from the menu of the Script Editor application.

Classes of AppleScript edit

{alias, application, boolean, class, constant, date, file, integer, list, number, POSIX file, real, record, reference, RGB color, script, text, string, Unicode text}
{centimeters, feet, inches, kilometers, meters, miles, yards, square feet, square kilometers, square meters, square miles, square yards, cubic centimeters, cubic feet, cubic inches, cubic meters, cubic meters, cubic yards, gallons, liters, liters, quarts, grams, kilograms, ounces, pounds, degrees Celsius, degrees Fahrenheit, degrees Kelvin}

Commands edit

Working with AppleScript one might come across AppleScript commands, scripting addition commands, user-defined commands and application commands.

The standard additions to AppleScript contains a range of commands available to all scripts. The commands are:

Comments edit

To document comments a programmer usually writes some comments along the way. Single line comments are written after # or --. Multi line comments are wrapped in (* *).

#  This is a single line comment
-- This is a single line comment
(* This is a 
   multi line 
   comment *)