Reading and writing preferences

Discussion in 'Mac Programming' started by nelly22, Aug 28, 2011.

  1. nelly22 macrumors 6502

    Joined:
    Sep 29, 2009
    #1
    I been trying in past few weeks to make my AppleScript to read and write preferences to plist file.

    I now know how to read/write using defaults to top level of plist file, but if i try to read/write more complex data to array then things get complicated.

    Similar array what i try to do is BrowserWindowState in com.apple.finder.plist.

    Could anybody help me or share subroutine which does this?

    Thanks
     
  2. larkost macrumors 6502a

    Joined:
    Oct 13, 2007
    #2
    If you are not just doing key-value pairs then the 'defaults' command is going to make like really difficult (you have to re-write the entire entry in the root dictionary every for every change). The next step that many admins take is to use PlistBuddy (a search should get you going with that), but there are so many oddities about using that that I usually skip it and use Python scripts with the scripting bridge (Py-ObjC, but the Ruby or Perl bridge would work just the same) and call in to NSPropertyListSerialization.
     

Share This Page