Skip to content

Instantly share code, notes, and snippets.

Created April 15, 2013 21:55
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
An old half-finished Applescript where I was looking at automating a download of my pinboard bookmarks into Camino. Been quite a while since I used Camino - dated 2011.
-- pinboard username and password
property pbuser : ""
property pbpass : ""
--Download bookmarks via curl to desktop (because can use shortcut when selecting file for import via UI scripting)
do shell script ("cd ~/Desktop; curl https://" & pbuser & ":" & pbpass & " -o pinboard.html")
--import bookmarks via UI scripting
tell application "System Events"
if UI elements enabled then
tell process "Camino"
set frontmost to true
end tell
click menu item "Import Bookmarks…" of menu of menu bar item "File" of menu bar 1 of process "Camino"
click pop up button of window "Import Bookmarks" of process "Camino"
click menu item 5 of menu 1 of pop up button of window "Import Bookmarks" of process "Camino"
keystroke "D" using {command down} --go to desktop downloads?
keystroke "pinboard" --this works as long as no other file called "pinboard not the right file", etc.
keystroke return
tell application "System Preferences"
set current pane to pane ""
display dialog "UI element scripting is not enabled. Check \"Enable access for assistive devices\""
end tell
end if
end tell
--delete the previous pinboard folder
tell application "Camino"
with timeout of 120 seconds
delete bookmark folder "pinboard"
end timeout
end try
end tell
--rename the new imported folder
tell application "Camino"
set name of bookmark folder "Imported Bookmarks" to "pinboard"
end try
end tell
--delete pinboard file from the desktop --not finished this bit!
tell application "Finder"
move file (((path to desktop) & "pinboard.html") as string) to trash
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment