Post to del.icio.us from Safari

Based on a combination of Safari, Applescript, Pukka, and Quicksilver, several mac power-users have found acceptable solutions for posting to del.icio.us from Safari. However, I have a slightly different workflow for del.icio.us than Splee, so I customized it a bit. I have a few requirements for an acceptable del.icio.us workflow:

  • Immediate access to tag entry with autocomplete.
  • Immediately successive chance to fill in a description. I have found that forcing myself to type descriptions of every bookmark has assisted dramatically in finding relevant links quickly in the future.

With the workflow described below, I can hit CMD-D in Safari, immediately start typing my tags (assisted by autocomplete), tab to the description, type my blurb, and hit CMD-enter to post. Smooth as silk for my needs.

First, create the following script ("Pukka Post to Delicious.scpt" for me) in a location that Quicksilver will index (I use a directory named "Scripts" in my user's "Documents" directory): set account to "myaccount"

tell application "Safari" set myURL to URL of document 1 set myTitle to do JavaScript "document.title" in document 1 set myReferrer to do JavaScript "document.referrer" in document 1 set mySelection to do JavaScript "window.getSelection() + ''" in document 1 end tell

tell application "Pukka" activate

tell application "System Events"
    tell process "Pukka"
        keystroke "n" using {command down}
        delay 0.1
        tell application "Pukka" to activate
    end tell
end tell

end tell

tell application "Pukka" reset set post url to myURL set post title to myTitle if (length of mySelection is not 0) and (length of myReferrer is not 0) then set post description to mySelection & " (linked via " & myReferrer & ")" else if (length of mySelection is not 0) then set post description to mySelection end if set selected account to account end tell

tell application "Pukka" activate

tell application "System Events"
    tell process "Pukka"
        tell application "Pukka" to activate
        keystroke tab
        keystroke tab
    end tell
end tell

end tell

Second, create a trigger in quicksilver that simplies calls this script directly, set the trigger to CMD-D, and set the scope to Safari.

Third, have Pukka running all the time, and strongly consider registering it.

This setup is the first one I've found that rivals the standard del.icio.us Firefox extension for convenience and features. I preserved the logic from Splee's script that fills in the selected text (with referrer info) if you have actually selected text, but lets you fill in your own description if you have not selected text.

Comments

Thanks!

Great article!Thanks!It's worthy to read carefully.

rweurwu

Submitted by adam on Fri, 2006-11-24 01:24.

Thanks! I’ve made the correction.

a d a m

small modification..

using the latest version of pukka (1.6.7), when you use the script, your account isn't automatically selected. luckily, there is a keyboard shortcut to select your del.icio.us account in pukka, so you can add, in the last set of a statements, the starred line below, and everything works.

awesome script you have here!
--
tell application "System Events"
tell process "Pukka"
tell application "Pukka" to activate
** keystroke "]" using command down**
keystroke tab
keystroke tab
end tell
end tell
end tell
--

DeliciousSafari lets you easily post to del.icio.us from Safari

I've written a plug-in for Safari that will do this. You can check it out at http://delicioussafari.com.

Cool

Cool, I will check it out.

a d a m

Syntax error

When I try to complile, I get a syntax error:

"Expected expression but found unknown token."

Any suggestino

Did you paste it directly

Did you paste it directly into Script Editor? I've had problems before when I forgot and pasted into another editor and saved that way.

Typo

It's "Splee" ;) Glad you found my script useful, and I like your additions.

Oops...

Thanks! I've made the correction.

a d a m

Post new comment

The content of this field is kept private and will not be shown publicly.