• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Plist Problem (LNS Property List Tools)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Plist Problem (LNS Property List Tools)


  • Subject: Plist Problem (LNS Property List Tools)
  • From: Rob Stott <email@hidden>
  • Date: Fri, 7 Mar 2008 12:14:05 +0000

Hi,

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!

Regards
Rob









Important: This message is intended only for the use of the individual or entity to which it is addressed and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If the reader of this message is not the intended recipient, or the employee or agent responsible for delivering the message to the intended recipient, you are hereby notified that any dissemination or copying of the communication is strictly prohibited. If you have received this communication in error, please notify the writer immediately by telephone and return the original message via postal service to the writer's attention at the above address. Thank you.

Watt Gilchrist Limited. Albion Mills, Albion Road. Bradford, BD10 9TQ
Registered in England
873405

 _______________________________________________
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

  • Follow-Ups:
    • Re: Plist Problem (LNS Property List Tools)
      • From: Philip Aker <email@hidden>
  • Prev by Date: re: Sometime error -10006 copying a folder
  • Next by Date: Re: Plist Problem (LNS Property List Tools)
  • Previous by thread: Re: best options for HTML file to text conversion?
  • Next by thread: Re: Plist Problem (LNS Property List Tools)
  • Index(es):
    • Date
    • Thread