Automate tasks using AppleScript and Terminal
You can use AppleScript with Terminal to save time or automate repetitive tasks. Terminal is a scriptable app that responds to AppleScript commands. These commands are described in Terminal’s AppleScript dictionary.
View Terminal’s AppleScript dictionary
Drag the Terminal icon onto the Script Editor icon.
Both Terminal and Script Editor are located in the /Applications/Utilities folder.
In AppleScript, you can use the
Do Shell Script command to send a UNIX shell script command to Terminal.
Run AppleScript scripts from Terminal
You can run AppleScript scripts from Terminal using the
Enter the following in the Terminal window:
In this example, scriptname is the name of the AppleScript script you want to run.
For more information about the
osascript command, see the osascript man page.