Using TextExpander to Generate Amazon Affiliate Links

Over the weekend, Brett Kelly whipped me up a really fast Python script for TextExpander that would generate an Amazon Affiliate link for me. Tested it out, and it works great.

However, I know how nerdy some people on the internet get, and how we’re obsessed with our shortlinks. So, I turned to a couple of my friends who are also adept at script hacking for an answer. Using Ruby, one of them came up with the perfect solution, which I’ve posted on Pastebin.

Paste that script into TextExpander (make sure you set it to be a Shell Script), replace my affiliate code with yours (I mean, you can leave mine if you want, but I assume you’d like the perks), give it a shortcut (I use ;amzn), and you’re set.

To make this work, navigate to the Amazon product you would like to link to, and copy the URL. Then, invoke the script via your shortcut. Those long URLs will be cut down to something much more manageable, like http://amzn.com/B002QEBMBY/?tag=niclake-20

Neat, huh? This should work just fine for you, though you should obviously verify your links to make sure they’re working properly before use.

Posted: Monday, Jul 16, 2012