Keyboard shortcut to search for selected/highlighted text

This will work while in Chrome:

  • First highlight some text
  • Hit CTRL+C - This copies the text
  • Hit CTRL+T - This creates a new tab and makes it the focus
  • Hit CTRL+V - This pastes the text in the Omnibox (Chrome defaults the cursor there)
  • Hit Enter - This will search the text in the Omnibox

Want to automate it? Use AutoHotKey to make it an automatic macro using CTRL+Alt+S Use this script::

^!s::
  Send ^c
  Send ^t
  Send ^v
  Send {Enter}
Return

FYI, I tested this script and it works in Chrome.


I have two answers for this in AHK as well.

This is global applicable anywhere (not only in chrome). Just select text and press Windows+G

#g::  ;;Google selected text
   Send, ^c
   Run, http://www.google.com/search?q=%Clipboard%
Return

One is this from my answer here. Select Text and press Windows+Shift+G. This is different in that it just gives you a link on the clipboard.

; Search google for the highlighted word
; then get the first link address and put it on the Clipboard

^!r:: Reload

#+g::
    bak = %clipboard%
    Send, ^c
    ;clipboard = %bak%`r`n%clipboard%
    Query = %clipboard%
    wb := ComObjCreate("InternetExplorer.Application")
    ;wb := IEGet()
    wb.Visible := false
    wb.Navigate("www.google.com/search?q=" Query)
    While wb.readyState != 4 || wb.document.readyState != "complete" || wb.busy ; wait for the page to load
      sleep 100
    ; loop % (Nodes := wb.document.getElementById("rso").childNodes).length
    ;     Links_urls .= (A_index = 1) ? Nodes[A_index-1].getElementsByTagName("a")[0].href : "`n" . Nodes[A_index-1].getElementsByTagName("a")[0].href
    ; Msgbox %Links_urls%

    Nodes := wb.document.getElementById("rso").childNodes
    First_link := Nodes[0].getElementsByTagName("a")[0].href
    Clipboard = %First_link%
    TrayTip, First Link on Google Search, %First_link% `r`n Ctrl+V to paste the link
return