Skip to content

Instantly share code, notes, and snippets.

@bachya
Created September 9, 2014 21:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bachya/3660c24b3f79f4187254 to your computer and use it in GitHub Desktop.
Save bachya/3660c24b3f79f4187254 to your computer and use it in GitHub Desktop.
Exports bookmarks from Spillo into CSV format
-- Build a CSV string of all the bookmark data:
set bookmarkCsv to {"url,title,desc,date,unread,private,tagged"}
tell application "Spillo"
repeat with b in bookmarks
set theUrl to url of b
set theTitle to title of b
set theDesc to desc of b
set theDate to date of b
set unreadStatus to unread of b
set privateStatus to private of b
set end of bookmarkCsv to {"\"" & theUrl & "\"," & "\"" & theTitle & "\"," & "\"" & theDesc & "\"," & "\"" & theDate & "\"," & "\"" & unreadStatus & "\"," & "\"" & privateStatus & "\""}
end repeat
end tell
-- Write the CSV data to a file
set AppleScript's text item delimiters to "\n"
my appendToFile(bookmarkCsv as text, ((path to desktop) as text) & "spillo.csv")
-- METHODS --
on appendToFile(textToWrite, filepath)
try
open for access file the filepath with write permission
write (textToWrite & return) to file the filepath starting at eof
close access file the filepath
on error
try
close access file the filepath
end try
end try
end appendToFile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment