Google-search a word/phrase with right-click ~ great for textbooks, old books


#1

People often encounter difficult words, esp in:

  • textbooks (including those people need to read to see if they’re getting the right dental/medical treatment)
  • old books
    It would be incredibly useful to me to be able to right-click a word, and tap one button to do a google search on that word.

PS I’ve been using Sumatra for awhile now and I love how light-weight it is.


#2

Ideally speaking the search engine would be configurable, for those who’d rather not use Google. That way we can specify something like https://search-engine.com/search?q=%s and Sumatra would replace %s with proper encoded text before invoking the default browser.


#3

Also requesting that feature.

Documents often need further explaining for which nothing is easier than highlight and right mouse search.


#4

Relevant list of GitHub issues can be found here (so more duplicates aren’t created):


#5

@SumatraPeter

I know your not an advocate for AutoHotKey “Workarounds”
however based on your comments and

right button search request by @Tim_Marshall + @than

I thought some of you might like to test out the following simple AHK code
just save it as say SEARCH.AHK

; Web lookup for any text including SumatraPDF
; Highlight some text then press Alt & Right Button

!RButton::

; Save and clear clipboard
StoredClipboard := ClipboardAll
Clipboard:= ""

; Send copy command (^c) to collect selected text
SendInput, ^c
; Wait a mo
ClipWait, 1

Run https://www.startpage.com/do/dsearch?query=%Clipboard%

; Reset Clipboard
Clipboard := StoredClipboard
Return

you can replace the startpage line with your preferred search engine e.g.

Run http://www.google.com/search?q=%Clipboard%

you can even change browser

Run "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" "http://www.google.com/search?q=%Clipboard%"

NOTE:- that’s all on one line and in this case the search needs to be enclosed in quotes

you can also try

Run https://en.wikipedia.org/wiki/%Clipboard%

or a translator or dictionary or … let your imagination take you there

If you don’t have latest portable AutoHotKey Zip
Download from https://autohotkey.com/download/ahk.zip

save zip file currently (April 2014) its AutoHotkey_1.1.28.02.zip
extract its contents and drop SEARCH.AHK onto
AutoHotkeyU32.exe

Tested with XP up to Win8.1 Pro x64 using several browsers etc.
(can’t test on Win 10 at present) if all is well there will be a green H icon in the Icon tray

If you want a second choice such as translate you can add to the end of the above text (after the return) this section

; Web translate for any text including from within SumatraPDF
; Highlight some text then press AltGR Key (that's the alt key to right of spacebar)

 *RAlt::

; Save and clear clipboard
StoredClipboard := ClipboardAll
Clipboard:= ""

; Send copy command (^c) to collect selected text
SendInput, ^c
; Wait a mo
ClipWait, 1

Run https://translate.google.com/?hl=en&q=%Clipboard%

; Reset Clipboard
Clipboard := StoredClipboard
Return

Hyperlinks not working when "DiskAccess = 0"
#6

How many such workarounds does one keep accumulating over time as Band-Aids to missing functionality in a program? Anyway, as I’ve said earlier you are free to use AHK or anything else as stopgap measures and so are others, and my personal preference has no bearing on it.

BTW you’ve used StoreClipboard once and then StoredClipboard.

Also, a “StoredClipboard =” at the end might be useful in order to free up memory in case the clipboard’s original content was quite large.


#7

Thanks Peter,

Think of it as an extension (Band-Aid) to windows outside of SumatraPDF

Well spotted. I have changed code above so both read as StoredClipboard , not so logical at start but hopefully indicative, the intent was to preserve users current clipboard contents so it can be restored (no matter how big it was)

[UPDATE]
Also have expanded examples again
what’s everyone’s favourite choice of look-up?


#8

I prefer DuckDuckGo.


#9

Favourite look-up has to be Google for me


#10

I downloaded the .zip file, unpacked it and it looks like this
in my folder-
Compiler
AutoHotkey.chm
AutoHotkeyA32.exe
AutoHotkeyU32.exe
AutoHotkeyU64.exe
Installer.ahk
license.txt
Template.ahk
WindowSpy.ahk

Which one would be the SEARCH.AHK ?
Thanks


#11

Read the thread carefully: