Quick short-URL AppleScript
Here’s a short AppleScript that looks at the frontmost window in Safari, grabs the URL, runs it through the Metamark shortening service, and sticks the result on the clipboard.
I run it via LaunchBar and paste the results into Twitter, generally.
tell application "Safari" set longURL to URL of front document end tell set shellScript to ("curl --url \"http://metamark.net/api/rest/simple?long_url=" & longURL & "\" ") set shortURL to (do shell script shellScript) set the clipboard to shortURL
Please note that the line beginning with “set shellScript” should be all on one line; I’ve broken it here in the interests of readability.
Update: Graham Ballantyne offers his version of this script, which is very nice.
And here’s another one from Brad MacDonald.