Created
December 11, 2010 17:15
-
-
Save NelsonMinar/737478 to your computer and use it in GitHub Desktop.
AutoHotkey script to make CapsLock open URLs and search Google
This file contains 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
; AutoHotkey script to make CapsLock open URLs and search Google with Clipboard contents. | |
; By Nelson Minar <[email protected]> Inspired by code at http://www.autohotkey.com/forum/topic14656.html | |
CapsLock:: | |
url := RegExReplace(Clipboard, "^\s+|\s+$") ; Trim whitespace | |
if RegExMatch(url, "^(http|ftp|telnet)") { | |
; Do nothing if it already looks like a URL | |
} else { | |
; Escape the query string. Could escape more, but this seems sufficient for Chrome | |
StringReplace, url, url, `%, `%25, All | |
StringReplace, url, url, &, `%26, All | |
StringReplace, url, url, +, `%2B, All | |
url := "http://www.google.com/search?&q=" . url | |
} | |
Run %url% | |
return |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Looks similar to mine: https://gist.github.com/823381#L73