Saturday, January 26, 2008

How to search in google from any windows application easily

How often do you find yourself wanting to search in Google when the active application is not your browser? If you too find that copying the text, switching to browser and searching is tedious, read on.

AutoHotKeyI use FeedReader a lot and found myself always doing Google searches of text in it a lot by manually copying word(s) and pasting them in the search box of Firefox. So I thought about a way to quickly perform Google searches by simply pressing a hot key (keyboard shortcut) with text selected in whichever windows program it is in. It’s just 4 lines of code using AutoHotKey.

  1. #s::
  2. Send, ^c
  3. Run, http://www.google.com/search?q=%ClipBoard%
  4. Return

To make use of the above, install AutoHotKey first, paste the above in notepad, give it any file name w/ .ahk extension.Close the file and double click on it. You should see a ‘H’ shaped icon in the system tray. From now on, whenever you wanted to search for a word or bunch of words in any program, simply select that text w/ your mouse and hit ‘S’ key w/ Windows key pressed i.e., Win+S. It will copy the text to clipboard, launch your default browser and present you w/ the results page.

I’ve also set Win+G to do the same like so (append the following to the .ahk file you created above):

  1. #s::
  2. Send, ^c
  3. Run, http://www.google.com/search?q=%ClipBoard%
  4. Return

Similarly, I use the following to visit a website by selecting the link to it (when the URL is in plain text editors like notepad) by pressing Win+U:

  1. #u::
  2. Send, ^c
  3. Run, %ClipBoard%
  4. Return

If you are not interested in installing AutoHotKey for whatever reason, you can acheive the same using the also free HoeKey or by having .exe file of the above code (to convert a .ahk to .exe, you again need AutoHotKey).

1 comment:

Zee said...

hii ,,, are you using this blog??
please contact me at : z.hamdani38@gmail.com