Jump to content

Quick Search (Updated)


Damein
 Share

Recommended Posts

I posted this when I first joined, but I updated it and I also added a couple websites to the search function.

It's pretty basic, you have a hotkey you set and that allows you to bring up the Search GUI and you first select what website you want to search on and then click submit once you enter into the field what you wish to search for. You can also paste from clipboard to do a quicker search.

Here is the source:

#include <GUIConstantsEx.au3>
 
Global $Website

HotKeySet("`", "ShowGUI")
 
GUICreate("Quick Search", 200, 130)
    $WebsiteMenu = GUICtrlCreateMenu("Websites")
    $WebsiteItemGoogle = GUICtrlCreateMenuItem("Google", $WebsiteMenu)
    $WebsiteItemYahoo = GUICtrlCreateMenuItem("Yahoo!", $WebsiteMenu)
    $WebsiteItemBing = GUICtrlCreateMenuItem("Bing", $WebsiteMenu)
    $WebsiteItemWiki = GuiCtrlCreateMenuItem("Wikipedia", $WebsiteMenu)
    $WebsiteItemYouTube = GUICtrlCreateMenuItem("YouTube", $WebsiteMenu)
    $WebsiteItemLyrics = GUICtrlCreateMenuItem("Lyrics", $WebsiteMenu)
    $hLabel = GUICtrlCreateLabel("You are currently not searching", 0, 0, 200, 20)
    $SearchEdit = GUICtrlCreateEdit("", 0, 20, 200, 20)
    GUICtrlSetState(-1, $GUI_HIDE) ; Hide this control until we have a website to search
    $SearchButton = GUICtrlCreateButton("Submit", 60, 50, 60, 20)
    GUICtrlSetState(-1, $GUI_HIDE) ; Hide this control until we have a website to search
    $Clipboard = GUICtrlCreateButton("Paste", 60, 80, 60, 20)
    $sCurrWebsite = ""
 
While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $WebsiteItemGoogle
            $WebSite = "Google"
        Case $WebsiteItemYahoo
            $WebSite = "Yahoo"
        Case $WebsiteItemBing
            $WebSite = "Bing"      
  Case $WebsiteItemWiki
            $WebSite = "Wikipedia"
        Case $WebsiteItemYouTube
            $WebSite = "YouTube"
        Case $WebsiteItemLyrics
            $WebSite = "Lyrics"
        Case $SearchButton
            If $WebSite = "Google" Then
            $SearchQuery = ControlGetText("Quick Search", "", "Edit1")
            ShellExecute("http://www.google.ca/search?hl=en&safe=off&q=" & $SearchQuery)
            GUISetState(@SW_HIDE)
        EndIf
            If $WebSite = "Yahoo" Then
            $SearchQuery = ControlGetText("Quick Search", "", "Edit1")
            ShellExecute("http://search.yahoo.com/search;_ylt=Ah1UsM_xzvpK1uhhoabYUSqbvZx4?p=" & $SearchQuery & "&toggle=1&cop=mss&ei=UTF-8&fr=yfp-t-701")
            GUISetState(@SW_HIDE)
        EndIf
            If $WebSite = "Bing" Then
            $SearchQuery = ControlGetText("Quick Search", "", "Edit1")
            ShellExecute("http://www.bing.com/search?q=" & $SearchQuery & "&go=&form=QBLH&scope=web&qs=n&sk=&sc=8-4")
            GUISetState(@SW_HIDE)
        EndIf          
  If $WebSite = "Wikipedia" Then
            $SearchQuery = ControlGetText("Quick Search", "", "Edit1")
            ShellExecute("http://en.wikipedia.org/wiki/Special:Search?search=" & $SearchQuery & "&go=Go")
            GUISetState(@SW_HIDE)
        EndIf
            If $WebSite = "YouTube" Then
            $SearchQuery = ControlGetText("Quick Search", "", "Edit1")
            ShellExecute("http://www.youtube.com/results?search_query=" & $SearchQuery & "&aq=f")
            GUISetState(@SW_HIDE)
        EndIf
            If $WebSite = "Lyrics" Then
            $SearchQuery = ControlGetText("Quick Search", "", "Edit1")
            ShellExecute("http://www.lyrics.com/search.php?keyword=" & $SearchQuery & "&what=all&search_btn.x=0&search_btn.y=0")
            GUISetState(@SW_HIDE)
        EndIf
    Case $Clipboard
        $ClipBoardContents = ClipGet()
        ControlSetText("Quick Search", "", "Edit1", $ClipBoardContents)
    EndSwitch
 
 
If $WebSite <> $sCurrWebsite Then ; If we do check then we get flickering as we SHOW the controls on each pass
        GUICtrlSetData($hLabel, "You are currently searching: " & $WebSite) ; This is how you change the text of a control
        GUICtrlSetState($SearchEdit, $GUI_SHOW) ; We have a website, so SHOW the control
        GUICtrlSetState($SearchButton, $GUI_SHOW) ; We have a website, so SHOW the control
        ControlFocus("Quick Search", "", "Edit1")
        $sCurrWebsite = $WebSite
    EndIf
WEnd
 
 
    Func ShowGUI()
    GUISetState(@SW_SHOW)
EndFunc

MCR.jpg?t=1286371579

Most recent sig. I made

Quick Launcher W/ Profiles Topic Movie Database Topic & Website | LiveStreamer Pro Website | YouTube Stand-Alone Playlist Manager: Topic | Weather Desktop Widget: Topic | Flash Memory Game: Topic | Volume Control With Mouse / iTunes Hotkeys: Topic | Weather program: Topic | Paws & Tales radio drama podcast mini-player: Topic | Quick Math Calculations: Topic

Link to comment
Share on other sites

  • 1 month later...

150 views, but no comments or anything :graduated:

MCR.jpg?t=1286371579

Most recent sig. I made

Quick Launcher W/ Profiles Topic Movie Database Topic & Website | LiveStreamer Pro Website | YouTube Stand-Alone Playlist Manager: Topic | Weather Desktop Widget: Topic | Flash Memory Game: Topic | Volume Control With Mouse / iTunes Hotkeys: Topic | Weather program: Topic | Paws & Tales radio drama podcast mini-player: Topic | Quick Math Calculations: Topic

Link to comment
Share on other sites

Thank you Damein, for the search Gui

I find it Interesting , i noticed in the begining when i added my hotkey , i got the Gui then clicked on paste and nothing happened.

Did not notice Websites until i've read the script , then i clicked on it. which in turn had the search providers.

Thank you Again.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...