Created
June 30, 2017 22:06
-
-
Save ahtn/4b0d033b9baa8d936accc2cf2465d168 to your computer and use it in GitHub Desktop.
Bash and Autohotkey scripts to google search highlighted text
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
; This Autohotkey script does a google search on the highlighted-text | |
SendMode Input | |
RegRead, OutputVar, HKEY_CLASSES_ROOT, http\shell\open\command | |
StringReplace, OutputVar, OutputVar," | |
SplitPath, OutputVar,,OutDir,,OutNameNoExt, OutDrive | |
browser=%OutDir%\%OutNameNoExt%.exe | |
!^s:: | |
{ | |
BlockInput, on | |
prevClipboard = %clipboard% | |
clipboard = | |
Send, ^c | |
BlockInput, off | |
ClipWait, 2 | |
if ErrorLevel = 0 | |
{ | |
searchQuery=%clipboard% | |
GoSub, GoogleSearch | |
} | |
clipboard = %prevClipboard% | |
return | |
} | |
GoogleSearch: | |
Run, %browser% "http://www.google.com/search?q=%searchQuery%" | |
return |
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
#!/bin/bash | |
# Google search the highlighted text (requires: xdg-utils, xsel) | |
xdg-open "https://google.com/search?q=$(xsel)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment