Scripting Remote Desktop


AppleScript and Automator are two tools used to simplify repetitive tasks with Mac OS X applications. They both can be used to interact with ARD. AppleScript is a programming language in almost every respect, while Automator is a graphical tool used to create workflows by dragging individual actions into a chain of events. While you can use both AppleScript and Automator with ARD, the basics of each tool are not within the scope of this book. In this lesson, you'll be concentrating specifically on the way each tool can be used to interact with ARD. Some additional sample scripts are available in the Administrator's Guide and from the ARD 3 Resources website.

Using AppleScript

AppleScript is generally harder for the novice to use and, in the case of Apple Remote Desktop, is more limited in capability. AppleScript may be the right choice, however, for a seasoned AppleScript programmer, or for someone who just needs to do some basic tasks. ARD's AppleScript dictionary contains many functions, such as:

  • Add computers to a computer list

  • Copy or install items

  • Initiate or terminate a control, observe, share, or screen lock task

  • Generate reports

  • Open items

  • Logout the current user

  • Wake, sleep, restart, or shut down the computer, set startup disk

You can view the entire AppleScript dictionary for ARD from within Script Editor by choosing File > Open Dictionary, and selecting the Remote Desktop application.

Here is a simple AppleScript that could be used to put a list of computers to sleep for the night:

 tell application "Remote Desktop" set tired_computers to computer list "Sleepers" execute (make new sleep task) on tired_computers end tell 


Just create a computer list called "Sleepers" that contains each computer that should be put to sleep, and then just run the AppleScript.

Using Automator

Automator is similar to AppleScript in a number of ways, but with an entirely different user interface. With Automator, you drag available actions into your workflow. Data passes from one action to the next until the workflow is complete. Many of the same things that are available in AppleScript are available in Automator, although you may find yourself writing AppleScript within Automator to do exactly what you need done.

Here is a sample Automator workflow that just connects to every machine in the "Kiosk Machines" computer list. First, it will close all open Finder windows, then it will run an AppleScript on each computer to instruct Safari to open the Apple Store's Web site.




Apple Training Series(c) Mac OS X v10. 4 System Administration Reference
Apple Training Series: Mac OS X v10.4 System Administration Reference, Volume 2
ISBN: 0321423151
EAN: 2147483647
Year: 2006
Pages: 128

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net