Re: Plist Problem (LNS Property List Tools)
Re: Plist Problem (LNS Property List Tools)
- Subject: Re: Plist Problem (LNS Property List Tools)
- From: Philip Aker <email@hidden>
- Date: Fri, 07 Mar 2008 08:27:38 -0800
On 08-03-07, at 04:14, Rob Stott wrote:
I'm trying to use Late Night Software's Property List Tools
scripting addition to change part of a plist but I'm getting some
odd results. Maybe I've spotted a bug or maybe I'm just doing
something dumb.
I have a handler that looks like this;
on alterTextProperty(theFile, theItemID, theValue)
set thePlist to read property list theFile
set |NS.string| of item theItemID of |$objects| of thePlist to
theValue
store property list thePlist in theFile
end alterTextProperty
The handler's intended to change the value of certain bits of the
plist.
If I compare the before and after plist using Property List Editor
then they both look as I'd intended - identical apart from the bit I
changed. However, the new plist is unuseable.
If I open both plists in TextWrangler and make the same change (not
using AppleScript) then everything works fine.
The only clue I've managed to find is that when viewed in
TextWrangler, the structure of the plist XML has changed after
editing by my applescript handler.
Example of broken file (edited by my applescript);
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd
">
<plist version="1.0">
<dict>
<key>$archiver</key>
<string>NSKeyedArchiver</string>
<key>$objects</key>
<array>
<string>$null</string>
<dict>
<key>BottomMargin</key>
<real>18</real>
Example of good file (before editing);
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd
">
<plist version="1.0">
<dict>
<key>$archiver</key>
<string>NSKeyedArchiver</string>
<key>$objects</key>
<array>
<string>$null</string>
<dict>
<key>$class</key>
<dict>
<key>CF$UID</key>
<integer>27</integer>
</dict>
<key>BottomMargin</key>
<real>18</real>
Am I doing something dumb or is the scripting addition broken? Is
there an alternative method? Any suggestions appreciated!
If this is a nib file, I'd say all bets are off.
Philip Aker
echo email@hidden@nl | tr a-z@. p-za-o.@
_______________________________________________
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