Created
October 17, 2014 18:50
-
-
Save drdrang/b8fc0a16e857a9cbbbcf to your computer and use it in GitHub Desktop.
A TextExpander AppleScript snippet for inserting an affiliate link to the current Amazon page.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set myTag to "thingy" | |
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 itemID to do shell script cmd | |
set aLink to "http://www.amazon.com/gp/product/" & itemID & "?tag=" & myTag |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment