Quick Google look-up of selected text

Press Alt+G after selecting the text

;Google lookup
!g::
OldClipboard:= Clipboard
Clipboard:= ""
Send, ^c ;copies selected text
ClipWait
Run http://www.google.com/search?q=%Clipboard%
Sleep 200
Clipboard:= OldClipboard
Return

 

Edit: Part of the script had been converted to a link and was not showing properly. I've now edited this.

Parents
  • Hi Nora,

    I'm very interested this script. I frequently use google to search words during translation. I never used AHK before. It seems very powerful. I just tried this script. When I press Alt+G, only the google search window pops up. The selected texts are not pasted into the search box. Would you please kindly advise what to do at your convenience? Thanks,

    Regards,
    Ivan
  • Hi guys,

    This doesn't work for me either now I test it, but there is a script here in the AHK site that does work:

    ;------------------------------------------------------------------------------
    ;Google lookup
    ;------------------------------------------------------------------------------
    ^!g::
    prevClipboard := ClipboardAll
    SendInput, ^c
    ClipWait, 1
    if !(ErrorLevel) {
    Clipboard := RegExReplace(RegExReplace(Clipboard, "\r?\n"," "), "(^\s+|\s+$)")
    If SubStr(ClipBoard,1,7)="http://"
    Run, % Clipboard
    else
    Run, % "www.google.com/search Clipboard
    }
    Clipboard := prevClipboard
    return

    To make it work I have to press Ctrl+c to copy the text selected to my clipboard and then press Ctrl+Alt+g.

    Paul Filkin | RWS

    Design your own training!
    You've done the courses and still need to go a little further, or still not clear? 
    Tell us what you need in our Community Solutions Hub

  • But perhaps also note that the weblook up tool on the appstore can do this already so if you wanted to have this ability to look things up in websites and have the result in Studio then it might be better for your purposes?

    multifarious.filkin.com/.../

    There is also another app on the appstore that can use the results as autosuggest so this might be even more useful!

    appstore.sdl.com/.../

    Paul Filkin | RWS

    Design your own training!
    You've done the courses and still need to go a little further, or still not clear? 
    Tell us what you need in our Community Solutions Hub

Reply Children
  • Paul Filkin said:
    But perhaps also note that the weblook up tool on the appstore can do this already so if you wanted to have this ability to look things up in websites and have the result in Studio then it might be better for your purposes?

    multifarious.filkin.com/.../

    There is also another app on the appstore that can use the results as autosuggest so this might be even more useful!

    appstore.sdl.com/.../
     

    This is absolutely true and I was thinking about it yesterday, although I've stopped using Web Lookup because things were just too crowded with the new 2017 features and opening Web Lookup results on a second monitor always seemed awkward. With this script I can have the search run on a second monitor without interfering with Studio. Maybe that would be a variation or option that we could suggest for the Web Lookup app: the ability to run outside of Studio. But wait... I think that's what IntelliWebSearch does already. : )

    Anyway, it's nice to have as many tools as possible at our disposal!