

Here’s the AppleScript content of the snippet: applescript:ģ: tell application "Safari" to set theURL to the URL of the front documentĥ: set cmd to "echo '" & theURL & "' | perl -pe 's#^.*/(?:dp|gp/product)/(+).*$#$1#'"Ĩ: set aLink to "" & itemID & "?tag=" & myTag Because I’ve learned that this is pretty much always the situation when I make an Amazon link, I save myself a step of copying the URL by having AppleScript get it. It doesn’t use the clipboard it assumes that the product page for the item I want to link to is currently in the frontmost Safari tab. It’s an AppleScript snippet and is triggered by the abbreviation amazon. Here’s my TextExpander snippet for getting Amazon affiliate links:

Gabe’s new system relies on a seemingly magical sequencing of the two apps he uses, and I distrust magic. I generally prefer to maintain as much control over my workflows as possible, even if it means a little more work for myself. I’m always happy to replace my scripts with a professionally made and supported alternative and here’s a good way to do that. Gabe used to use Keyboard Maestro to do his affiliate linking. I won’t reveal the app combination here you should go read his post and use his affiliate links. Both work behind the scenes and require no action on his part. One of the apps cleans the cruft out of URLs on the clipboard and the other adds the affiliate codes. Through a clever combination of two menubar apps that automatically watch the clipboard and transform certain URLs, he doesn’t actually do any work-he just copies a product URL from his browser and then pastes it. “Workflow” may not be the right word for what Gabe’s doing. 1 Then I realized that the new version of TextExpander, with its support of JavaScript for Automation, offers a simpler way of making the links. I realized that although I’ve written about my system for iTunes links, I haven’t written up my current TextExpander snippet for Amazon links. Yesterday, Gabe Weatherhead showed his current workflow for making iTunes and Amazon affiliate links. Next post Previous post Clean Amazon links with TextExpander
