I find it particularly useful to be able to copy a file, folder, URL, or search term to the clipboard and then with one hotkey, open it up. Here is the script I use with AutoHotkey to assign Win+O to open whatever’s in the clipboard.
First it checks to see if the clipboard contains a file, folder, or program that exists on disk. If not, does is it appear to be a URL? And if still not, just Google the clipboard contents.
; Execute the contents of the clipboard. Set browser to your preferred browser.
browser := userprofile "\Local Settings\Application Data\Google\Chrome\Application\chrome.exe"
#o::
contents = %clipboard%
StringSplit, SplitArray, contents, `n
Loop, %SplitArray0%
{
_line := SplitArray%a_index%
; First attempt a shell execute
Run, %_line%,, UseErrorLevel
; If that didn't work, try something else
if (ErrorLevel = "ERROR")
{
; Does the clipboard contain a URL?
FoundPos := RegExMatch(_line, "A)\w[^\s]*\.(?:com|co|uk|gov|edu|tv|net|org|tel|me|us|mobi|es)(?:\z|/.*)\z")
if FoundPos
Run %browser% %_line%
else
Run http://www.google.com/search?q=%_line%
}
}
return
browser := userprofile "\Local Settings\Application Data\Google\Chrome\Application\chrome.exe"
#o::
contents = %clipboard%
StringSplit, SplitArray, contents, `n
Loop, %SplitArray0%
{
_line := SplitArray%a_index%
; First attempt a shell execute
Run, %_line%,, UseErrorLevel
; If that didn't work, try something else
if (ErrorLevel = "ERROR")
{
; Does the clipboard contain a URL?
FoundPos := RegExMatch(_line, "A)\w[^\s]*\.(?:com|co|uk|gov|edu|tv|net|org|tel|me|us|mobi|es)(?:\z|/.*)\z")
if FoundPos
Run %browser% %_line%
else
Run http://www.google.com/search?q=%_line%
}
}
return
http://coad.net http://facebook.com http://noahcoad.com






