Property List Tools

NO LONGER MAINTAINED

Download Version 1.0.7 (139KB) – 32 & 64-bit Intel Mac OS X 10.6 or later

Download Version 1.0.6 (152KB) – PowerPC Mac OS X 10.3.9 or later, 32-Bit Intel Mac OS X 10.4 or later

The Property List Tools Scripting Addition allows AppleScript to load and store Mac OS X Property Lists. The scripting addition allows you to export any AppleScript data structure to a property list.

Credits/Legal

THIS SOFTWARE IS PROVIDED AS-IS, WITHOUT WARRANTY OF ANY KIND. THE AUTHOR DISCLAIMS ANY DAMAGES THAT MAY RESULT FROM THE USE OR MISUSE OF THIS SOFTWARE.

THIS SOFTWARE IS COPYRIGHT © 2004-2010 LATE NIGHT SOFTWARE LTD. & MARK ALLDRITT. YOU MAY USE AND/OR DISTRIBUTE THE SOFTWARE WITHOUT RESTRICTION. IF YOU BUNDLE THE SOFTWARE WITH ANY COMMERCIAL OFFERING, YOU MUST DISPLAY THIS COPYRIGHT NOTICE IN THE SOFTWARE’S DOCUMENTATION AND ABOUT BOX.

Installation Instructions

To install the Property List Tools scripting addition on Mac OS X systems:

  1. Create a folder named ScriptingAdditions in your user account’s Library folder (known as ~/Library) if one does not already exist.
  2. Copy the Property List Tools.osax into the ~/Library/ScriptingAdditions folder.

Getting Started

The Property List Tools package contains a simple example script that illustrates how to use the Property List Tools scripting addition to read and write property list files containing various kinds of data.

To view the Property List Tools dictionary, which lists all the commands and their options, just drop the Property List Tools.osax file onto your favourite script editor.

Here is some example code illustrating how Property List Tools can be used:

~~~~ set myFolder to path to desktop folder as string

-- It all works best with user properties
store property list {|myName|:"Mark Alldritt", |myAge|:42, today:current date}     in file (myFolder & "test1.plist")
read property list file (myFolder & "test1.plist")
tell application "Finder" to open alias (myFolder & "test1.plist") -- show the generated plist file

-- But the osax also supports keyword properties
store property list {name:"Mark Alldritt", |myAge|:42} in file (myFolder & "test2.plist")
read property list file (myFolder & "test2.plist")
tell application "Finder" to open alias (myFolder & "test2.plist") -- show the generated plist file

-- And finally, you can store any kind of AEDesc that is not directly supported by the plist format
script testObj
   property abc : 100
   on testing()
      return "Done!"
   end testing
end script
store property list {|myName|:"Mark Alldritt", |myData|:testObj} in file (myFolder & "test3.plist")
tell application "Finder" to open alias (myFolder & "test3.plist") -- show the generated plist file

set newTestObj to read property list file (myFolder & "test3.plist")
tell |myData| of newTestObj to testing()
-- Result: "Done!"

~~~~

Change History/Release Notes

1.0.7 June 28, 2010

  • Support 64-Bit Intel systems.

1.0.6 June 7, 2006

  • Support Mac OS X 10.3.9 systems.
  • Resolve byte order issues on Intel machines.
  • Properly handle boolean values on PowerPC machines.

1.0.5 April 21, 2006

  • The Get Recent Files demo has been updated to work with Mac OS X 10.4.6.
  • The Read Me First document once again directs you to this Web page.

1.0.4 March 31, 2006

  • Native Intel Macintosh support (distributed as a Universal binary).
  • The read property list command can now parse strings containing Property List XML data.
  • The store property list command can now return Property List XML data as a string.

1.0.3 February 7, 2005

  • Fixed a problem where integer values read from property lists were converted to reals when they are written back to a property list file.

1.0.2 May 19, 2004

  • Fixed a bug in the store property list command where HFS file paths with file names greater than 31 characters in length would be truncated. To specify an HFS path with a lone file name you must say: file “volume:folder:long-file-name.plist”. Use of AppleScript’s file specification (FSSpec/typeFSS) class will result in truncated file names. POSIX file path specifications are not affected by this bug. Added a new example script (Get Recent Files.scpt) to the package.

1.0.1 April 7, 2004

  • Fixed a crashing bug reading 64-bit integer values from a property list file.

Leave a Reply

The home of Script Debugger