Created
September 9, 2014 21:09
-
-
Save bachya/3660c24b3f79f4187254 to your computer and use it in GitHub Desktop.
Exports bookmarks from Spillo into CSV format
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 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