Team LiB   Previous Section   Next Section
Location Manager

Syntax

tell app "Location Manager"

   set curApp to current location (* set a variable to location returned 

   by "current location" property *)

end tell

Dictionary classes

application

This class represents the Location Manager program:

tell app "Location Manager" to launch

The application has one or more location objects as elements. To examine one of these objects, use code such as:

tell app "Location Manager" to get location

1

See the location class later in this chapter. The Location Manager application also has one property, current location.

The following are application elements:

location

If you use Location Manager to set several different configurations (which is what it is designed for), then each configuration or location is accessible as a location element. This code example gets the name of each location and displays the names in a dialog window:

set locs to "The location names are: " & return

   tell application "Location Manager"

   repeat with ct from 1 to (count location)

      set locs to locs & (name of location ct) & return

   end repeat

   display dialog locs

end tell

The following are application properties:

current location location

This current location property returns the currently active location. It is a settable property; see the Examples section at the end of this chapter.

location

This class represents a location you can create with Location Manager. A location is a set of system configurations such as file sharing, TCP/IP, and Extension sets, among other settings. The application class for Location Manager has location objects as elements:

tell app "Location Manager" to get current location -- returns the active location

name international text (read-only)

This is the name the location has in the Location Manager window. For example:

tell app "Location Manager" to get location

"cable_tcpip"

The return value for this code phrase (if you had a location called "cable_tcpip") looks, naturally enough, like:

location "cable_tcp" of application "Location Manager"

Examples

tell application "Location Manager"

   set loc to current location

   if (name of loc) is "cable_tcpip" then

      set current location to location "dialup"

   end if

end tell



    Team LiB   Previous Section   Next Section