Creating a Script
Generally, most scripts are written in Script Editor documents. Scripts can also be written in Xcode, but this is typically for scripts that require advanced user interfaces.
Launch Script Editor in
/Applications/Utilities/
.Press Command-N or select File > New.
If the script isn’t configured for the correct language, choose the language in the navigation bar.
Write your script code in the editing area. Newly written code is uncompiled and formatted as new text.
Click the Compile button () to compile the script and check for syntax errors.
If a syntax error occurs, an alert is displayed.
If the script compiles, code formatting is applied at this time.
Using an AppleScript Template
Script Editor includes a number of built-in templates for creating common types of AppleScripts, including droplets, Mail rule scripts, and Messages handler scripts.
Launch Script Editor in
/Applications/Utilities/
.Choose File > New from Template.
Select a script template.
A new Script Editor document window opens containing prewritten code and preconfigured settings. The following screenshot shows an example of a script created using a template.
Customize the script.
Copyright © 2018 Apple Inc. All rights reserved. Terms of Use | Privacy Policy | Updated: 2016-06-13