Created
April 3, 2009 03:34
-
-
Save arnaudsj/89622 to your computer and use it in GitHub Desktop.
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
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