Reading nested key-value pairs in plist
Reading nested key-value pairs in plist
- Subject: Reading nested key-value pairs in plist
- From: Reinhold Penner <email@hidden>
- Date: Wed, 18 Dec 2002 05:25:53 -1000
I've been playing with "defaults read..." for some time now and I can't
get it to work with more complex structures such as
com.apple.internetconfig.plist (it's fairly straightforward in simple
plist files, but this one is too nested for me. What I want to read is
a particular key (in this case "DownloadFolder"). I looked at the man
page for defaults and found this "very helpful" bug:
BUGS
Defaults can be structured in very complex ways, making it
difficult for
the user to enter them with this command.
I can get as far as spewing out the entire dictionary using
do shell script "defaults read com.apple.internetconfig 'Version 2.5.3'"
but obviously that's not too helpful. I can also grep for
DownloadFolder like this
do shell script "defaults read com.apple.internetconfig 'Version 2.5.3'
| grep 'DownloadFolder'"
--> " DownloadFolder = {"
but unfortunately, the value for that key is in the next line.
So, has anyone managed to retrieve a specific key-value pair from
internetconfig or another complex plist file? Or does anyone know of a
clever method to get the path of the user's download folder? Any code
is fine (Objective C, Java, AS, shell, KlingonScript, ... anything). I
would also settle for a construct that would access the next line of
the grep example shown above (JD, you surely must know how to do that).
TIA for any pointers, -Reinhold
_______________________________________________
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.