Re: Plan E from Outer Space
Re: Plan E from Outer Space
- Subject: Re: Plan E from Outer Space
- From: Philip Aker <email@hidden>
- Date: Wed, 17 Jun 2009 19:03:06 -0700
On 2009-06-17, at 14:13:22, Scott Babcock wrote:
You may want to check out the 'PlistBuddy' utility as an alternative
to 'defaults'. The 'defaults' utility is extremely weak at dealing
with anything other than simple values in root-level keys.
'PlistBuddy' has a comparatively rich set of capabilities. This is
an Apple utility that gets included with every updater they've
shipped since at least the Mac OS X 10.2 (Jaguar) days, and it looks
like they're finally going to include it in the standard
distribution in Snow Leopard.
On Leopard, I have it at: /usr/libexec/PlistBuddy. But I don't know if
it's only installed when Developer Tools is installed.
I don't know how 'PlistBuddy' interacts with the specified plist. If
it uses NSUserDefaults, you should be able to modify settings of
active applications. Otherwise, you'll need to make sure the
application isn't running when you're making your changes.
$ nm -g /usr/libexec/PlistBuddy
shows that it's CoreFoundation and lower only, and doesn't use
CFPreferences.
However because of the way NSUserDefaults/CFPreferences work, I think
it's not guaranteed that any utility addressing preferences property
list files will work as expected unless the target app has been quit
and the utility uses the equivalent of CFPreferencesAppSynchronize()
both before and after altering the files. That's because, in the case
where the target app lets the system handle its preferences
synchronization automatically on quit, the actual writing to disk is
done at the leisure of the system (which can be up to several seconds
on my setups).
Philip Aker
echo email@hidden@nl | tr a-z@. p-za-o.@
Democracy: Two wolves and a sheep voting on lunch.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden