Skip to content

Instantly share code, notes, and snippets.

@arnaudsj
Created April 3, 2009 03:34
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 arnaudsj/89622 to your computer and use it in GitHub Desktop.
Save arnaudsj/89622 to your computer and use it in GitHub Desktop.
on run
getBitLyURL()
end run
on getBitLyURL()
set BitLyLogin to "bitlyapidemo"
set BitLyApiKey to "R_0da49e0a9118ff35f52f629d2d71bf07"
tell application "Camino"
set bkmkTab to current tab of front browser window
if exists bkmkTab then
set curlStatement to "/usr/bin/curl \"http://api.bit.ly/shorten?version=2.0.1&login=" & BitLyLogin & "&apiKey=" & BitLyApiKey & "&history=1&format=xml&longUrl=" & (URL of bkmkTab) & "\" | /usr/bin/awk -F'<shortUrl>' '{print $2}' | /usr/bin/awk -F'</shortUrl>' '{print $1}'"
set shortURL to do shell script curlStatement
set the clipboard to shortURL
else
display dialog "Please have a page open to make it tiny"
end if
end tell
end getBitLyURL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment