Does anyone have an automated way to export bookmarks as an HTML file (something I can automate to run every 24 hours)?
This looks highly automatable.
It looks like the format has been changed and you can no longer grep them put (it is a binary file).
Any chance it is just that the format is the same and it is just a binary plist rather than a pure text plist?
If that’s the case, you could work around that by converting it in the script.
Here’s some more recent posts about working with Safari bookmarks in a plist file with other methods.
Primarily it’ll bejust a set of names and URLS, and apps like Alfred reference them dynamically, so it should be possible.
I ended up using launch to trigger a bash shell script that copies the ~/Library/Safari/Bookmarks.plist to a folder (renaming the copy each day).
The problem I am having is the script will not copy
In Safari if you choose File>Export Bookmarks you get an html file of bookmarks. This should be AppleScript compatible. I haven’t even opened the AppleScript ediotr for years, but I do think this is doable.
I had it working when it was under File but now it is under File/Export…
Does anyone have any guidance on how to do this in AppleScript?
(* As far as I know, there isn’t a method in the Applescript dictionary for Safari to save bookmarks. I think you have to use GUI scripting *)
tell application "Safari" activate end tell try tell application "System Events" tell process "Safari" tell menu "File" of menu bar 1 click tell menu item "Export" click (* N.B. ellipsis after "Bookmarks" not fullstops/periods *) tell menu item "Bookmarks…" of menu "Export" click delay 1 (* Safari remembers the last place you saved. *) (* Insert code here for a different filename if required *) (* The filename is already selected. *) -- keystroke "new filename" (* Save the file *) keystroke return end tell end tell end tell end tell end tell on error errMsg display dialog "Error: " & errMsg end try