AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Autohotkey to do global google search

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
rosto



Joined: 14 Feb 2006
Posts: 40

PostPosted: Fri Apr 10, 2009 8:08 am    Post subject: Autohotkey to do global google search Reply with quote

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
Back to top
View user's profile Send private message
Slanter



Joined: 28 May 2008
Posts: 739
Location: Minnesota, USA

PostPosted: Fri Apr 10, 2009 8:10 am    Post subject: Reply with quote

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

_________________
Unless otherwise stated, all code is untested

(\__/) This is Bunny.
(='.'=) Cut, copy, and paste bunny onto your sig.
(")_(") Help Bunny gain World Domination.
Back to top
View user's profile Send private message Visit poster's website
rosto



Joined: 14 Feb 2006
Posts: 40

PostPosted: Fri Apr 10, 2009 9:19 am    Post subject: Reply with quote

Slanter wrote:
Something like this would probably work
Code:
#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.
Back to top
View user's profile Send private message
SoLong&Thx4AllTheFish



Joined: 27 May 2007
Posts: 4999

PostPosted: Fri Apr 10, 2009 9:45 am    Post subject: Reply with quote

Yes, search the forum there are plenty of scripts that already to this, including replacing "incorrect" characters
_________________
AHK Wiki FAQ
TF : Text files & strings lib, TF Forum
Back to top
View user's profile Send private message
silveredge78



Joined: 25 Jul 2006
Posts: 481
Location: Midwest, USA

PostPosted: Fri Apr 10, 2009 5:48 pm    Post subject: Reply with quote

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.

Code:
; 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%
}

_________________
SilverEdge78
Back to top
View user's profile Send private message
sinkfaze



Joined: 18 Mar 2008
Posts: 5044
Location: the tunnel(?=light)

PostPosted: Fri Apr 10, 2009 7:13 pm    Post subject: Reply with quote

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":

Code:
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

_________________
Try Quick Search for Autohotkey or see the tutorial for newbies.
Back to top
View user's profile Send private message Send e-mail
arun
Guest





PostPosted: Fri Mar 05, 2010 1:53 pm    Post subject: Can we open google only in one site Reply with quote

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?

sinkfaze wrote:
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":

Code:
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
Back to top
juergs



Joined: 29 Jul 2010
Posts: 1

PostPosted: Sat Jul 31, 2010 3:27 pm    Post subject: Correction to opening a multiple windows Reply with quote

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
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group