Remote Desktop’s AppleScript Basics

AppleScript scripts consist of commands that are sent to objects. Objects can be a wide variety of things, including applications, scripts, windows, settings, or the Finder. These objects can receive a specific set of commands and respond with the desired actions. Essentially, a script tells an application (Remote Desktop in this case) to either complete a certain task or retrieve information. You can give the script decision-making capabilities by using conditional statements; you can give the script a memory by defining variables.

Remote Desktop has made all of its fundamental functions scriptable. The tasks that you perform as an administrator by pointing and clicking the mouse can all be accomplished by running an AppleScript. For example, you can:

ÂGet information on or rename a computer

ÂAdd computers to a list

ÂCopy or install items

ÂExecute a report task

Using the Remote Desktop AppleScript Dictionary

Each scriptable application contains an AppleScript dictionary—the list of objects and messages that an application can understand. For example, in Remote Desktop’s dictionary there is an object named “computer list” that has this entry:

computer list n [inh. item] : A list which holds computers.

ELEMENTS

contains computers; contained by application.

PROPERTIES

id (Unicode text, r/o) : The unique identifier (UUID) of the computer list.

name (Unicode text) : The name of the computer list.

A “computer list” is an object which contains other objects (“computers” in this case) and has properties like its “id” and its “name.” When queried, this object can return the values for the properties (in Unicode text as indicated), but you can’t change “id” from within the script (it’s labeled r/o for read-only). This object can be acted upon by the “verbs,” or messages, in a script.

The dictionary also contains “verbs,” or messages. These verbs are commands that act on the objects in the dictionary. For example, in Remote Desktop’s dictionary there is a verb named “add,” and this is its entry:

add v : Add a computer to a task.

add computer : The computer.

to computer list : The computer list (or task) to add the computer to.

Chapter 8 Administering Client Computers

157

Page 157
Image 157
Apple 3 manual Remote Desktop’s AppleScript Basics, Using the Remote Desktop AppleScript Dictionary