|  | Executing AppleScripts Using ARD

The second kind of script you can execute, and the most common in the Mac OS X environment, is an AppleScript. AppleScripts are files that contain English-like commands, using the AppleScript programming language, and are created using the Script Editor application. AppleScripts can be executed on client computers in several ways: they can be compiled, saved and executed as an application, or sent at once using the command line.

To learn more about AppleScript, see AppleScript Help in Help Viewer, or go to www.applescript.com.

#### To send and execute a compiled AppleScript:

1. Save the AppleScript as an application.
2. Open Remote Desktop.
3. Select a computer list.
4. Select one or more computers in the Remote Desktop window.
5. Use the Copy Items command to copy your script to the client machines.

   Use the Copy Items command with the Open After Copying option selected in the Copy Items dialog.

#### To execute an AppleScript using the Send UNIX Command:

This method uses the osascript command. For detailed information on osascript, see the osascript man page.

1. Select a computer list.
2. Select one or more computers in the Remote Desktop window.
3. Use the Copy Items command to copy your script to the client computers.
4. After copying the script, choose Manage > Send UNIX Command.
5. Type or paste the AppleScript in the UNIX Command window, like this:
   osascript -e '[First line of script]' -e '[Next line of script]'

   For example, a simple script to create a folder and set its label would be entered (all in one line) as:

   osascript -e 'tell the application "Finder"' \
   -e 'make new folder' \
   -e 'set the name of the result to "New Folder"' \
   -e 'set the label index of folder "New Folder" to 2' \
   -e 'end tell'
6. Click Send.

   The client computer executes the script.