Applescript to copy selected text plus page URL in Safari
I do a lot of online research. I would like to be able to select text then run an applescript to add the selected text plus the page URL to the clipboard. I have found a couple scripts that come close to what I want to do, but they don't work. They get the URL and usually some other information, but instead of the slected text, I get "missing value". Does anyone know how I can make this work?
The scripts I found that do kind of what I want, but don't work are:
http://hints.macworld.com/article.php?story=20080207080505152
This script works, but it copies URL and page title rather than URL and selected text:
I would be so grateful for some help on this.