Hacking Safari Bookmarks

Monday 24 February 2003 at 21:35

Charles Miller asked Is there an AppleScripty way to manipulate Safari bookmarks? I'd like to be able to mirror my NetNewsWire subscriptions there.

Safari's AppleScript dictionary doesn't expose anything bookmark related. Maybe it will in a later beta release. In the meantime the bookmarks are stored as XML in ~/Library/Safari/Bookmarks.plist. I edited that file directly with the Property List Editor and successfully added bookmarks, though the editing would have been quicker in emacs. I basically copied other entries modifying values as appropriate. I made up the WebBookmarkUUID element (you'll have to look at the file to see what I'm talking about). I have no idea if the one I concocted will conflict with Safari's ID generation. Also, I had to quit and re-launch Safari for the bookmark to show up in the UI.

Rob Gould commented

22 January 2004 at 23:26

Can anyone tell me if this bookmarks XML file has been the same format since Safari came out? If I write an app that goes and edits this file, will it break in earlier versions of Safari?