AppleScript Deployment Options

AppleScripts can be deployed throughout the Mac Operating System.

A script is considered deployed when installed on workstations or servers for use. Mac OS X offers a variety of storage and usage locations for scripts depending on the requested type of functionality and how they interact with the user or the operating system. The deployment location selected determines how a user finds and interacts with the script and, in some cases, what features the script can perform. Some locations are required for certain script types while others are optional depending on the user’s preference for accessing tools and applications. While not an exhaustive list of every possible option, most of the popular deployment options are listed below.

Mac OS X Dock

When a script is saved as an application, it can be added to the dock like any other Mac app. This gives the user quick ad easy access to the script. They can click to run it or drag and drop files onto its icon. The script would typically be stored in the Applications folder, but it could be located in any folder.

Scripts Menu

Once activated in the Script Editor application’s preference, a script icon and menu appear on the right side of the menu bar and can display any number of scripts that are stored in the appropriate folder. The scripts can be organized into subfolders which will appear as nested submenus. They can also be placed into application folders making them only appear in the menu when the appropriate application is in front. This is one of the best ways to deploy a suite of scripts as they become neatly organized and accessible through familiar style menus. With this option, scripts can only be run and can’t have files or folders dropped onto them for processing.

Services Menu

The Services menu can be found in two places in the Mac OS user interface: under the application menu and in the contextual menu in the Finder and other applications. When scripts are stored here, they will appear in these menus giving the user quick and convenient access.

Finder Window Toolbar

Scripts can be attached to the Finder window toolbar making them available to a user from any window they are browsing. From here, they can be run by clicking on their icon or files and folders may be dropped on them for processing.

Print Dialog

The Mac OS X Print dialog has a PDF drop down list that can include AppleScripts allowing custom handling of the PDF file that is created from the print process. For example, a script might add a standard disclaimer page, compress the file, save it to a specific project folder and then email to a predetermined list of contacts.

Mail Rule

Apple’s Mail application allows users to setup rules for how incoming messages are handled. One of the available options allows an AppleScript to handle processing the qualifying messages. When you select an action of “Run AppleScript” a second popup menu will display all of your available custom script options.

The script might send the sender a standard response assuring them that their request will be handled shortly or thank them for signing up on a mailing list. Another script might automatically move website form information into a database for storage or further processing. Save a list of all your incoming emails in a text file, extract image enclosures from every message and save them to a specific folder on a server or display a custom dialog when an urgent message is received.

Calendar Alarm Action

The Apple’s Calendar app makes it possible to schedule a script to run at a specific time. When creating an event, an alert can be configured to “open file.” If the selected file is a script saved as an application, it will launch and execute at the scheduled time.

Other Locations

Many applications allow AppleScript code to be embedded into their internal structure or scripting function. Applications like FileMaker Pro allow scripts to be executed as part of an internal script while other applications provide a scripting palette or menu. Embedded scripts are often not ideal for complex solutions but for a small script tool that performs a handful of functions, it can be the ideal location.