using Quicksilver to get TinyURL

If you use Twitter you probably use TinyURL to shorten your URLs pretty often, I looked into doing this with Quicksilver, there are a couple of blog posts that show you how to do it, but none of them I really liked. One even said it was crap himself in the beginning of the post.

What I really want is this:

  • I would copy the URL I want to shorten to my OS X clipboard
  • I run something in Quicksilver
  • The clipboard will be updated with the shortened URL

This turned out to be extremely easy to do. Here’s a Ruby script that does exactly that. If you make the script executable, Quicksilver should include it in its catalog. So just copy a long URL into your clipboard (?-C), invoke Quicksilver, type the filename (I just type “tiny”), and wola, your clipboard will have the TinyURL so you can paste (?-V) it into wherever.

#!/usr/bin/env ruby
require 'net/http'
require 'uri'

def shorten(url)

IO.popen('pbcopy', 'w').puts "#{shorten(IO.popen('pbpaste', 'r+').read)}"

, ,

4 Responses to using Quicksilver to get TinyURL

  1. Dr. Drang March 4, 2008 at 1:07 pm #

    I’m no fan AppleScript’s, but this is a situation where it really is the best solution. Look toward the bottom of this post

    to find a 5-line AppleScript that does what you want. It uses Metamark, but changing to TinyURL would be a quick edit.

  2. ayn March 4, 2008 at 2:48 pm #

    not bad, thanks for sharing.

  3. ayn October 30, 2008 at 12:51 am #

    just updated the code to be a lot more concise.

  4. Arif December 27, 2008 at 2:30 am #

    Thanks Ayn, but for um us non-techies, how do you make this work? Do I save the script in the Actions folder under Application Support/Quicksliver/Actions?

Leave a Reply