Saving a Script
After you write a script, you can save it for future reference or to be run outside of Script Editor.
Saving a Script or Script Bundle
Scripts and script bundles open in Script Editor when double-clicked in the Finder.
Choose File > Save (or press Command-S) to display the save dialog.
Type a name for the script and choose an output folder.
Choose Script or Script Bundle from the File Format popup menu.
Click Save.
Saving a Script Application
Script applications, known as applets, work like other apps on your Mac. Double-click an applet to run it.
Choose File > Save (or press Command-S) to display the save dialog.
Type a name for the applet and choose an output folder.
Choose Application from the File Format popup menu.
If you want the script’s description—defined in the Accessory View pane—to display when the applet launches, select the “Show startup screen” checkbox.
If you want to create a stay-open applet, select the “Stay open after run handler” checkbox.
Click Save.
Protecting a Script’s Source Code
If you plan to distribute your script, you may wish to protect is source code. This is done by exporting the script in run-only format.
Choose File > Export to display the export dialog.
Type a name for the applet and choose an output folder.
Choose a format from the File Format popup menu.
If you’re saving in application format, choose whether you want a startup screen or a stay-open script.
Select the Run-only checkbox.
Click Save.
Code Signing a Script
By default, the security settings in OS X only allow the launching of apps (including applets and droplets) that have been created by you, downloaded from the Mac App Store, or created by developers identified by Apple. If you plan to distribute your scripts to others, you should consider code signing your scripts with an Apple developer ID.
You obtain a Developer ID certificate from Certificates, Identifiers & Profiles in your developer account and import it on your Mac. For detailed information about obtaining and importing a certificate, see Maintaining Your Signing Identities and Certificates in App Distribution Guide.
If the Bundle Contents pane isn’t visible, choose View > Show Bundle, press Command-0, or click the bundle contents button () in the toolbar.
Make sure the following highlighted fields are populated in the Bundle Contents pane.
Name—The name of your script.
Identifier—A uniform type identifier for your script. For information, see Uniform Type Identifiers Overview.
Short Version—The version number for your script.
Copyright—The copyright string for your script.
Choose File > Export to display the export dialog.
Type a name for the applet and choose an output folder.
Choose a format from the File Format popup menu.
If you’re saving in application format, choose whether you want a startup screen or a stay-open script.
Choose whether you want to save the script as run-only.
Choose your developer identity from the Code Sign popup menu.
Click Save.
Copyright © 2018 Apple Inc. All rights reserved. Terms of Use | Privacy Policy | Updated: 2016-06-13