Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Keyboard Shortcut - Launch a Google Search for Selected Text
If you often have to google for selected text, this keyboard shortcut can help. Typically, after selecting the text (from anywhere), you have to copy it (to the clipboard), start your browser, go to, paste it (from the clipboard) in the query field, and then click a button to launch the search. This whole process can be automated with the following AutoHotkey script:

Need help creating a keyboard shortcut with ShortKeeper using the following AutoHotkey code? This 5-minute tutorial will help!
ClipSaved := ClipboardAll
Clipboard =
SendInput, ^c
ClipWait, 2
if ErrorLevel 
  MsgBox % "Failed attempt to copy text to clipboard."
  TextSelected := Trim(Clipboard)
  Run % "" . TextSelected . "%22"
Clipboard := ClipSaved 

Spaces and tabs at the beginning and end of the selection will be omitted from the search.

This script will search for a phrase (instead of separate words). If you prefer to search for separate words, replace line #15 with:
Run % "" . TextSelected 
At line #15, you can specify your Google search country preference (e.g. for Canada, for Australia, etc.).

This script will restore the previous clipboard content.

This script is optimized to be used with ShortKeeper. As such, there is no "Return" at the end and variable(s) don’t need to be cleared. ShortKeeper will do this automatically. Just copy/paste this code in the PARAM field in ShortKeeper, set your hotkey, save, and you’re ready to use your new keyboard shortcut.

Google Search usually ignores punctuation that isn’t part of a search operator.
Enterpad: For those who need more than a few shortcuts.


Messages In This Thread
Keyboard Shortcut - Launch a Google Search for Selected Text - by denilama - 02-14-2018, 08:37 PM

Forum Jump:

Users browsing this thread: 1 Guest(s)