I wrote an AppleScript yesterday which generates a hierarchical
Property List (.plist) containing information about all your mailboxes
in Mailsmith. The script can be
<a href="http://www.scotlandsoftware.com/ftp/applescript/mailbox_plister.tgz">downloaded here</a>.
This might be of interest to Cocoa/Carbon developers who want to create
applications which integrate with Mailsmith via AppleEvents/AppleScript,
or indeed anyone who wants to know how to get hierarchical data from an
application via AppleScript, and into your own applications.
The generated property list is an array of dictionaries, with each
dictionary representing a mailbox. Dictionaries have keys and values
||display name of the mailbox
||unique id of the mailbox
||array of child mailboxes
The output is formatted to be as human-readable as possible, with proper
indenting etc (and nicer than that generated by Property List Editor, at
least for ASCII property lists). Take a look at some sample output in
<a href="http://www.scotlandsoftware.com/blog/dev/applescript/plister_output_ascii.txt">ASCII plist format</a>,
and in <a href="http://www.scotlandsoftware.com/blog/dev/applescript/plister_output_xml.txt">XML plist format</a>.
The script allows setting the following options:
- Whether to generate a traditional (ASCII) property list, or a new-style XML one.
XML is the default, using the Property List 1.0 DTD.
- Whether to generate empty "children" elements for mailboxes without children. If
disabled, "children" elements will only be generated for mailboxes which have at least
- You can also specify arbitrary text to prepend to all lines of the output. Could be
useful for increasing the base indenting level, or for some other, more exotic purpose
I can't think of at the moment!
The resulting property lists can be used in pretty much any way you
want. You can save them to files and open and edit them with Property
List Editor, read them directly into Cocoa objects via the appropriate
convenience initialisers from NSArray or NSDictionary, or run the script
directly via an NSAppleScript instance and use NSString's -propertyList
method on the result to get your mailbox tree into memory. Could be
useful for <a href="http://www.scotlandsoftware.com/images/msmith_mailboxes_outline_view.png">populating an NSOutlineView</a>,
for example. It's really up to you.