Re: Opening System Preference Panes
Re: Opening System Preference Panes
- Subject: Re: Opening System Preference Panes
- From: "Neal A. Crocker" <email@hidden>
- Date: Fri, 30 Aug 2002 19:39:19 -0700
Neil,
Thanks again. That was very interesting and I found all of the
system preferences information I was looking for -- and more. Can
you recommend a good book (or other source) for more information
about the guts of OS X?
I haven't made much use of books (other than freely available
electronic books in, for instance, PDF format), so, unfortunately, I
haven't anything to recommend along those lines. However, if you
don't have the Developer Tools, you should get them and install them.
Not only do you get extensive documentation on Applescript and the
guts of OS X for free, it is searchable in the Help Center through
Help Viewer (a pretty clunky, slow and painful application, but not
totally useless) and contains many PDF documents of the type I
alluded to above. [As a bonus, if you ever want to write an
applescript application with any user interaction more complicated
than a dialog box with a few buttons, you'll want Applescript Studio,
which comes with the Developer Tools. Applescript Studio looks to be
an awesome tool, though I haven't had a problem big enough to require
it, so I haven't made the plunge.]
You can get the Developer Tools several ways. First, they are
typically included on a separate CD in the box when you buy OS X.
Second, if your computer came with OS X installed, they will be in
the Installers folder of the Applications folder. Third, you can get
them for free at
http://developer.apple.com (incidently, perhaps the
best place to find out about the guts of OS X. It has a Google
powered search engine dedicated to searching just the site). The
developer site is also where you go for updates to the Developer
Tools.
Another exceptionally useful tool for getting info about the guts of
OS X is Google searching the web, believe it or not. You just have
to have a flair for constructing queries. Some useful OS X-guts
related topics are, of course, Cocoa, Carbon and Darwin (the variant
of unix at the heart of OS X), although queries should generally also
use much more specific keywords.
Another place to get interesting (and sometimes very esoteric)
tidbits about the guts of applescript is to join the
applescript-implementors mailing list (or peruse the archives) at
lists.apple.com. The topic for this list is primarily how make
scriptable applications, but there are occasional discussions about
the guts of applescript itself. Knowing how applescript (and
scripting applications) works underneath the hood can lead to some
rather arcane insights about how to solve scripting problems.
Neal.
Jon
On Friday, August 30, 2002, at 07:44 PM, Neal A. Crocker wrote:
Neil,
Thanks. That did the trick. Now I see the "hint" in the dictionary
that suggests that syntax. Do you know if there is a way to write
to set preferences from AppleScript (i.e., turn handwriting
recognition on/off)?
For that, you need to use the "do shell script" command (in
Standard Additions) to use the "defaults" shell command. The shell
command "defaults" let you access a more-or-less system-wide
database of preferences that includes the settings controlled by
the System Preferences. Setting can be written into the database
for any domain using key-value pairs, so you'll need to know what
domain to refer to, the appropriate key for you setting and the
values it takes. The domain for any give preference pane is of the
form "com.apple.preferences.xxx", where xxx depends on the
preference pane your are interested in. You should recognise this
form, by the way, since the applescript
tell application "System Preferences" to get name of panes
returns a list of strings of this form corresponding to the names
of each pane. Each name is actually the domain name you need.
As for how to discover what key and value to use, you can open
Terminal.app and expermiment with defaults shell command (which
incidentally lets you read out the keys and values for any domain
to the terminal window) while changing settings in the System
Preferences pane of your choice. Sometimes, valid keys don't exist
in the database, leaving the preference pane to use some hardwired
default value, but by changing thing the System Preferences pane,
you ought to be able to make any key controllable there show up in
the terminal. To find out the command syntax for the "defaults"
command, type "man defaults" (without the quotes) into a terminal
window and hit return.
Neal.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.