O'Reilly logo

AppleScript in a Nutshell by Bruce W. Perry

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

Appearance Control Panel

Syntax

tell app "Appearance" to get picture file of monitor 1 (* returns "no 
picture" if the desktop has a color but not a picture *)

Dictionary commands

count

This command returns an integer representing a count of certain Appearance objects, such as:

count of monitors

or:

count of themes

You can also use the syntax count each theme or count each monitor.

exists

This indicates whether an object exists and returns a boolean value, as in:

exists monitor 2

This command returns false if the machine is hooked up to only one monitor.

quit

This quits the Appearance application:

tell app "Appearance" to quit
run

This command sends a run Apple event to Appearance, which opens the application if it is not already open. Using this command is not necessary as AppleScript sends an implicit run command to the applications that are targeted in a tell statement. Chapter 7 , describes the tell statement.

Dictionary classes

Application

The Appearance Application class has two elements: theme and monitor. There are in reality about two dozen theme objects associated with each Appearance application and one or more monitors (depending on how many monitors are attached to your machine). The Application class has the following properties (appearing here in their Dictionary order), all of which are accessible by targeting the Appearance app in a tell statement. The properties are accompanied by their data type in parentheses:

name (string)

This represents the application’s ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required