Last active
August 29, 2015 13:56
-
-
Save drdrang/8851124 to your computer and use it in GitHub Desktop.
The AppleScript content of a TextExpander snippet that returns an Amazon Associates link to the item in the frontmost browser document. Commenting/uncommenting Lines 3 and 4 switch between Safari and Chrome.
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 "your-associates-tag" | |
tell application "Safari" to set theURL to the URL of the front document | |
--tell application "Chrome" to set theURL to the URL of active tab of front window | |
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