Jump to content


Photo

Autohotkey to do global google search


  • Please log in to reply
8 replies to this topic

#1 rosto

rosto
  • Members
  • 45 posts

Posted 10 April 2009 - 08:08 AM

Is it possible to use Autohotkey to do global google search (select a word in whatever application, use the shortcut and google does a search with this word??

Are there already scripts to do this?

Greetings,
Rosto

#2 Slanter

Slanter
  • Members
  • 739 posts

Posted 10 April 2009 - 08:10 AM

Something like this would probably work
#g::
   ClipTemp := Clipboard
   Send ^c
   Run, http://www.google.com/search?q=%Clipboard%
   Clipboard := ClipTemp
return


#3 rosto

rosto
  • Members
  • 45 posts

Posted 10 April 2009 - 09:19 AM

Something like this would probably work

#g::
   ClipTemp := Clipboard
   Send ^c
   Run, http://www.google.com/search?q=%Clipboard%
   Clipboard := ClipTemp
return


Would it be possible to create more of these scripts p.e. global amazon search, yahoo search etc. and put them all in one application?

If not, do I have to create of each script a .exe and load them all in memory?

sorry, I'm new to autohotkey.

#4 SoLong&Thx4AllTheFish

SoLong&Thx4AllTheFish
  • Members
  • 4999 posts

Posted 10 April 2009 - 09:45 AM

Yes, search the forum there are plenty of scripts that already to this, including replacing "incorrect" characters

#5 silveredge78

silveredge78
  • Members
  • 499 posts

Posted 10 April 2009 - 05:48 PM

I use the following script, which is basically a function being called multiple times as I need and how I need. I pass through an identifier for the popup name, and then the pre-fixed URL for whatever I am copying (ie: if I've highlighted something or not). I've included the examples that I use often.

Refer to my thread on this.

; IE AutoOpen Hotkeys
#w::IEAutoOpen("URL","")  ; WinKey+w				;;AutoOpen Link
#g::IEAutoOpen("Google","www.google.com/search?q=")  ; WinKey+g	;;AutoOpen Google and Search
#p::IEAutoOpen("Yahoo profiles","profiles.yahoo.com/")  ; WinKey+p	;;AutoOpen Yahoo Profiles Link
#u::IEAutoOpen("Free Dictionary search","http://www.thefreedictionary.com/")  ; Win+u	;;AutoOpen Free Dictionary

IEAutoOpen(Desc,URL)		; v1.0.2, 09/18/07
{
  ClipSaved := ClipboardAll	; Save the entire clipboard to a variable of your choice.
  Clipboard = %Clipboard%
  TextClip = %Clipboard%  
  Clipboard = 
  Send, ^c
  ClipWait, 1
  IEClip = %Clipboard%
  Clipboard = %TextClip%
  InputBox, URLString, %Desc%, Please enter the %Desc% string to be opened in IE:, , , , , , , , %IEClip%
  If (GetKeyState("Control")) And (URL = "")	; Suggested by Lexikos
    URLString = www.%URLString%.com		; Suggested by Lexikos
  Clipboard := ClipSaved	; Restore the original clipboard. Note the use of Clipboard (not ClipboardAll).
  ClipSaved =			; Free the memory in case the clipboard was very large.
  If ErrorLevel <> 0
    Return
  Run, iexplore.exe %URL%%URLString%
}


#6 sinkfaze

sinkfaze
  • Moderators
  • 6089 posts

Posted 10 April 2009 - 07:13 PM

Here's a simple GUI that can Google itself and several other sites listed in a dropdown. To do a general Google search, leave the dropdown blank, otherwise select the site you would like to use Google to search. Bear in mind that to keep this example simple I used only sites that end in ".com":

Gui, Add, Text, x10 y18, Select the site to Google:
Gui, Add, DropDownList, x10 y38 w150 vSearchSite, |Autohotkey|Yahoo|Amazon|eBay|Dictionary|Brittanica|Fark
Gui, Add, Edit, x10 y78 w150 vSearchTerms
Gui, Add, Button, x115 y118, Search 
Gui, Show, Center AutoSize, Googler!
return

ButtonSearch:

Gui, Submit, NoHide
if (SearchSite)
  Run, http://www.google.com/search?q=%SearchTerms%+site:%SearchSite%.com
else
  Run, http://www.google.com/search?q=%SearchTerms%
return

GuiClose:
ExitApp


#7 arun

arun
  • Guests

Posted 05 March 2010 - 01:53 PM

When I use this code, it actually opens a new window every time I press the keys. Is it possible to ensure that the words are checked only in one window instead of opening new window every time?

Here's a simple GUI that can Google itself and several other sites listed in a dropdown. To do a general Google search, leave the dropdown blank, otherwise select the site you would like to use Google to search. Bear in mind that to keep this example simple I used only sites that end in ".com":

Gui, Add, Text, x10 y18, Select the site to Google:
Gui, Add, DropDownList, x10 y38 w150 vSearchSite, |Autohotkey|Yahoo|Amazon|eBay|Dictionary|Brittanica|Fark
Gui, Add, Edit, x10 y78 w150 vSearchTerms
Gui, Add, Button, x115 y118, Search 
Gui, Show, Center AutoSize, Googler!
return

ButtonSearch:

Gui, Submit, NoHide
if (SearchSite)
  Run, http://www.google.com/search?q=%SearchTerms%+site:%SearchSite%.com
else
  Run, http://www.google.com/search?q=%SearchTerms%
return

GuiClose:
ExitApp



#8 juergs

juergs
  • Members
  • 1 posts

Posted 31 July 2010 - 03:27 PM

arun,

If you change

Run, iexplore.exe %URL%%URLString%

to
Run, %URL%%URLString%

This will result in the command running in your default browser.
It is a band-aid.

Peace,
Juergs

#9 Rineybree

Rineybree
  • Members
  • 3 posts

Posted 03 May 2012 - 02:49 PM

Sorry to resurrect the thread, but I wonder if I could make a small related request:

Could anyone add the ability to search the search field at <!-- m -->http://ejje.weblio.jp/<!-- m --> for text copied to the clipboard to one of the above scripts (or make a new one? All I need is the Weblio search above and Yahoo JAPAN)? Oh, and I use Google Chrome BTW.

Thanks!