Quick TinyURLs with TextExpander and AppleScript

[ Update (10/22/08): We've had many reports the original AppleScript by David Smalley has stopped working. TheĀ improved AppleScript by JD Strong continues to work. Even David Smalley posted that he is using JD Strong's AppleScript now.

Also, if you want to see the step-by-step instructions for adding this AppleScript to TextExpander, Jeff Gamet just posted a great tip at The Mac Observer. ]

I just came across this neat tip on developer David Smalley’s blog. It uses AppleScript to generate a tinyURL with a TextExpander abbreviation.

(If you’re not familiar with Tiny URL, it’s an online service that converts long URLs into short ones more appropriate to share in email and microblogs.)

I am no AppleScript maven, but it sounded pretty cool. I’ve been using Tiny URL a lot lately since I started using Twitter. So I consulted Greg, whose works on TextExpander development, to see what he thought. His response:

This does work, and it’s quite convenient. Here’s an easy way for you to import this:

And he sent me the AppleScript wrapped in a TextExpander Group. You can download it here:
http://www.smileonmymac.com/textexpander/tinyurl.textexpander.zip

Download and unzip it, and then add the group in the TextExpander preferences pane.

Then you’re set to follow Greg’s instructions:

You select a URL, copy it to the Clipboard, then type “tinyurl” (and your delimiter if you’re not doing instant expansion) then wait a few seconds and “tinyurl” will be replaced by a tiny URL.

If you’re a real geek, you can grab the AppleScript from the original blog post and create your own AppleScript snippet in TextExpander.

9 Responses to “Quick TinyURLs with TextExpander and AppleScript”

  1. Henrik says:

    Fantastic! Just got a Mac, and have been using Autohotkey on the PC before. I miss some features in TE, but this was a really, really nice tips. Gave me inspiration to create other applescript based replacements :)

    Thanks!

  2. Jean says:

    @ Henrik: Great! If you create any Applescripts you want to share, send me an email (jean@smileonmymac.com). If we post your tip on the blog, we’ll give you a license to one of our other products as our thanks.

  3. JD Strong says:

    This was a great start. I’ve added a little error checking and a faster call to the core TinyURL API here: http://jdstrong.com/textexpander_tinyurl_applescript

  4. dil okulu says:

    is there any information about this in other languages, maybe german or other else?

  5. Jean says:

    Dil: Here’s a post on a German-language blog about using AppleScript and TextExpander to create short URLs automatically:
    http://www.zettt.de/2008/07/urls-via-textexpander-und-tinyurl-kurzen-fur-alle-twitterer/

  6. Frank says:

    Could it be that this no longer works since very recently? Maybe Tinyurl have changed something with their service. Anybody got an updated version? I really liked this script!

  7. Jean says:

    @Frank: JD Strong’s script (Option 2) is what I use, and it’s still working for me.

  8. theGh0st says:

    Using tr.im makes shorter URLs, I added, modified and tweaked a few things in a few scripts and came up with this: http://tr.im/trimappelscript
    Hope someone will find it useful.

  9. Jono says:

    “I added, modified and tweaked a few things in a few scripts and came up with this: http://tr.im/trimappelscript

    I copied the script from your page, pasted it into TextExpander as an AppleScript snippet and set the Abbreviation to “ttrim”

    When I type ‘ttrim’ TextExpander inserts the ActionScript code instead of the trimmed URL from my clipboard.

    Any idea why?

Leave a Reply