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.

  • Do you mean how to open a new tab in Chrome? The answer is CTRL+L.

  • No, I mean how to open Chrome. I tried Run Chrome.exe but that opens an entirely new window in Chrome. I just want to open the Chrome I already have open.

  • I don't think you need to use:

    Run Chrome.exe

    I'd recommend you to assume that Chrome is already open. Just being simplistic at the beginning, then tuning up the AutoHotkey code once it works.

    Try using Nora's line of code:

    Run www.google.com/search

    This will open a new tab in your default browser (already open or not) with the address and searching parameter provided. But it won't open the tab in the number #1 position.

    Don't forget that Nora's script addresses the steps that consume more time if done manually: copying the selected text, switching to the browser application, opening Google web page, pasting the clipboard content and pressing Enter key. I understand that closing the new tab because it's duplicated somewhere else is one more step, sure, and it can be done with the procedure I posted last week, but I wouldn't say it's the most important. Little by little you catch the monkey.

  • Hi Ida,

    Try this:

    ;Linguee.com lookup
    !h::
    Sleep 200
    Send, ^c
    ClipWait
    Sleep 200
    WinActivate ahk_exe chrome.exe
    Sleep 200
    Send ^1
    Sleep 200
    Send ^l
    Sleep 200
    Send https://www.linguee.com/search
    Sleep 400
    Send {Enter}
    Sleep 1500
    Send ^v
    Sleep 400
    Send {Enter}
    Return

    Hope that works for you!

  • Hi!

    No, unfortunately not :/ It doesn't open Chrome. Very often when I try different script, it also causes the Studio segment to lock, which I don't understand, since as far as I know Ctrl+L is the shortcut for locking a segment, not Alt+e, Alt+f or Alt+h (all different shortcuts I've been trying to use).

    I found that the hotkeys I create work sometimes and sometimes not. So at some point they have worked with maybe Sleep 400, but then all of a sudden, I need Sleep 4000 for it to work, and then of course it is much slower. At this point, I would not use these (except for the google lookup one, which always works).

    I for example created a script for Eur-lex (EU's legislative database) which also only functions sometimes:

    ;Eur-lex.com lookup
    !f::
    Sleep 200
    Send, ^c
    ClipWait
    Sleep 50
    Run http://eur-lex.europa.eu
    Sleep 200
    Send ^l
    Sleep 50
    Send e
    Sleep 50
    Send {Space}
    Sleep 50
    Send ^v
    Sleep 200
    Send {Enter}
    Return

    Here it is annoying, because I don't in fact need to run the website - since I use "e" for it to create a search in the address bar (via the manage search engine function in chrome) - but since the Winactivate doesn't seem to work for me, this is the only way I can do it.

  • I got it to work! This is the script I've used:

    ;Linguee.com lookup
    !h::
    Sleep 200
    Send, ^c
    ClipWait
    Sleep 50
    WinActivate ahk_exe chrome.exe
    Sleep 200
    Send ^1
    Sleep 200
    Send ^v
    Send, {Enter}
    Return

  • I wrote everything the same way. Hopefully it will come out. I'm going to try

    ;Mabbly.com lookup
    !h::
    Sleep 200
    Send, ^c
    ClipWait
    Sleep 200
    WinActivate ahk_exe chrome.exe
    Sleep 200
    Send ^1
    Sleep 200
    Send ^l
    Sleep 200
    Send https://www.mabbly.com/
    Sleep 400
    Send {Enter}
    Sleep 1500
    Send ^v
    Sleep 400
    Send {Enter}
    Return

1 2 3 4