Apple Script is powerful scripting language for MacOS. It interacts with Mac programs and so can do lots of Automation things for you on the Mac.


–Integer Variables
set theFirstNumber to 3
set theSecondNumber to 2

–Variable Operations
set theAnswer to (theFirstNumber + theSecondNumber)
set theAnswer to (theAnswer + 1)

–String Variables
set theString to “3+2+1=”

–Display Dialog
tell application “Finder”

display dialog theString & theAnswer

end tell

Tell command

You can see we tell the Finder above. So each program has a dictionary that we can use to tell it to do something. To access the dictionary use: open ScriptEditor – Windows – Library – any System App (like Mail)

tell application “Mail”

–Create the message
set theMessage to make new outgoing message with properties {subject:theSubject, content:theContent, visible:true}

–Set a recipient
tell theMessage
make new to recipient with properties {name:recipientName, address:recipientAddress}

–Send the Message

end tell
end tell

  1. tell & set are AppleScript commands
  2. make & send are Mail (Standard Suite) commands, make new is a syntax of make command
  3. outgoing message & to recipient are the attributes of the make

More about Apple Script

Screen Shot 2015-03-31 at 4.03.05 pm

Use this table A1 to understand each keyword.

Do Shell scripts 

set hostname to "" do shell script "ping -c1 " & hostname