Recently, I had a need at work for an AppleScript to toggle between the US and UK number formats, located in the "International" Preference Pane under the "Formats" section. Well, actually, my boss had a need. Which, of course, means I had a need. I did a bunch of digging on macosxhints.com and various scripting sites, and found that I could do it with "Enable access for assistive devices" turned on (Universal Access prefs panel), and using Prefab's UI Browser application to identify the UI elements.
However, I had trouble selecting the "International" preference pane -- it turns out that it's not named com.apple.preferences.international or anything like that. A scan through the filesystem (using the Terminal) showed me that it was really named com.apple.Localization, based on seeing and exploring the Localization.prefPane directory under /System -> Library -> PreferencePanes. That worked. It's interesting that some of the preference pane names are what you'd expect, while others are not.
As a side note, somewhere (I forget where), I found an AppleScript code fragment that helped identify the pane correctly after I figured it out from the resource files:
tell application "System Preferences"
get name of current pane
end tell
Also, if anybody is interested, here is the basic AppleScript. Maybe it will save somebody else some time.
(* A quick-n-dirty way to select a Number Format
From the "International" Preference Pane.
Note that you need the "Enable access for
assitive devices" option turned on in the
"Universal Access" preference pane for this to work *)
(* Also, there is no error checking. Caveat emptor. *)
(* Fire up System Preferences *)
tell application "System Preferences"
activate
(* Guess what? It's not named
com.apple.preferences.international *)
set current pane to pane "com.apple.Localization"
end tell
(* Now, hook up with the System Events and pretend
that we are using the GUI. *)
tell application "System Events"
tell application process "System Preferences"
(* Tab group 1 is most elements in the pane. *)
click radio button "Formats" of tab group 1 of window "International"
(* Make the menu pop up. *)
click pop up button 1 of tab group 1 of window "International"
(* Pick seems to work well in this case. *)
pick menu item "United Kingdom" of menu of ¬
pop up button 1 of tab group 1 of window "International"
end tell
end tell
(* Bail out, now that we're done. *)
tell application "System Preferences" to quit
Mac OS X Hints
http://hints.macworld.com/article.php?story=2004070922035163