First of all, let me declare that I am a noob AHK coder. I came here looking for a quick answer and Teqchiqe's code didn't work for me. Moreover, he or she seems to be inactive on SO. In case anyone might find it useful, here is my simple code that seems to work.
This script copies whatever is currently highlighted to the clipboard and attempts to open that in the default browser. If the highlighted item is a URL all well and good it should open. If it's just a sequence of character such as a search term then the AHK thread will croak but AHK itself will persist. Try it, you'll see what I mean. It's not that bad.
#u::
clipboard =
Send ^c
ClipWait
Run, %clipboard%
Exit
It's quite possible that the choice of #u for activating this script was ill-advised; however, it fits with others I'm using. (Just beware.)
clipboard =
empties the clipboard so that AHK will notice when its contents become available. Send ^c
copies whatever is highlighted to the clipboard. ClipWait
pauses the script until the contents of the clipboard stabilise. Run, %clipboard%
opens the default browser, if necessary, and then sends the contents of the clipboard off to it.
Use it in good health.