Re: Adding a property value to a plist file
Re: Adding a property value to a plist file
- Subject: Re: Adding a property value to a plist file
- From: Emmanuel <email@hidden>
- Date: Wed, 12 Jul 2006 11:56:32 +0200
At 6:15 PM -0600 7/11/06, Jesse Almanrode - JA Computing wrote:
Ok, here is an easy one. I have done this before but for the life of
me cannot find my snippet of code that does it anywhere.
I have an plist file that I am planning to read from and write to
using AppleScript. My problem here lies in how do I create a new
property in the plist file (making the plist longer).
My plist file currently looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>ARYLib1</key>
<array>
<string>Some String</string>
<string>Some other String</string>
<false/>
</array>
</dict>
</plist>
So... I would be creating new ARYLib properties and increment them as
I do. Also, if someone would also give me the snippet to remove
properties from a plist file that would be nice too (I am sure I can
figure it out but hey, why re-invent the wheel if you don't have to?).
Any takers?
Check Satimage-software's XMLLib.osax, it's free and it provides all
commands you will need.
<http://www.satimage-software.com/en/plist_suite.html>
For instance here you would do:
set myPlist to PlistOpen theFile
PlistSet myPlist key "NewKey" to SomeValue -- can be a string, a
number, a list, a record, ...
Removing is not harder:
PlistRemoveChild myPlist key "OldKey"
Emmanuel
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden