Upgrade Your Life winner #3: Automate site searches with hotkeys

Upgrade Your Life winner #3: Automate site searches with hotkeys

Our final Upgrade Your Life contest winner comes from Duane E, who came up with a neat way to develop an AutoHotKey script for searching multiple sites in Firefox with a selected keyword from any applications. Details on how to implement it in Duane’s own words after the jump.

This AutoHotKey script will search one or multiple web sites in Firefox
after a user defined hotkey is pressed. The script requires that the
user has the text to search highlighted in a program (which doesn’t
have to be Firefox) and preferably has Firefox already open.
Because this script is dependent on the use of Firefox’s “Keyword
Searches”, before we create the script for AutoHotkey we must first
create the keyword searches for the sites we wish to use.
To do this,
simply go to the web site you wish to use, right click on the search
box and select “Add a Keyword for this Search”: Now you can choose the
keyword to use, a name for the bookmark and where to save the bookmark
(I recommend making a folder for all your Keyword Searches): Repeat
these steps for all the sites you wish to use, making note to remember
the Keywords you have chosen as they are needed in the next step.
Now that the keyword searches have been made we can create the script.
Install AutoHotKey if you haven’t already
and open up your script for editing by right clicking the AutoHotKey
icon in the system tray: Now we can add the following one site search
script template to the end of the script:

; You can replace this line to provide a description of what this script searches.
; REPLACE <HOTKEY> with a key, the resultant shortcut will be CTRL+Alt+<Hotkey>
Send ^c
IfWinNotExist ahk_class MozillaUIWindowClass
    Run Firefox
    WinWait ahk_class MozillaUIWindowClass
    MillisecondsToWait = 2000
    Sleep %MillisecondsToWait%    
    Send ^t
    Sleep 500
    MillisecondsToWait = 500
; REPLACE <FIRSTSITE> with the keyword of the search you wish to do (e.g. bookdepo)
Send <FIRSTSITE> ^v{Enter}
;Insert additional sites AFTER this line.
For additional sites, for each additional site, add the following AFTER
the <FIRSTSITE> line (making note to replace <ADDITIONAL
SITE> with the keyword for the additional site):
Send ^t
Sleep %MillisecondsToWait%

That’s it! You can have as many sites per search and as many searches
as you wish (provided they use different hotkeys). There are many
possible uses for this script, a book search, eBay searches, or you can
just simply set up single searches that can be activated in any

Log in to comment on this story!