Quick short-URL AppleScript

| | Comments (0)

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
& 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.

About this Entry

This page contains a single entry by Jason Snell published on March 20, 2009 9:13 AM.

MLB Network: The Eternal Baseball Tonight was the previous entry in this blog.

Geekery: Where am I? is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.