Sign in to follow this  
Followers 0
bobheart

Going to ask first if this can be done

3 posts in this topic

I don't want to mess with it if it can't be done All show the code and tell me if it can or can't be done .

What I want to have where you can put a word check the radio box and use that search engine .

So I could have a small bar to use for search .

;Generated with AutoBuilder 0.3

Opt("GUICoordMode", 1)
Opt("GUINotifyMode", 1)

GuiCreate("MyGUI", 392,266,10,10,0x04CF0000)
$input_1 = GUISetControl("input", "Word to Search", 150,20, 170,20)
$radio_1 = GUISetControl("radio", "Yahoo", 150,50, 70,20)
$radio_2 = GUISetControl("radio", "Google", 150,80, 60,20)
$radio_3 = GUISetControl("radio", "Altavista", 150,110, 70,20)
$radio_4 = GUISetControl("radio", "Search.com", 150,140, 80,20)
$radio_5 = GUISetControl("radio", "Ask Jeeves", 150,170, 80,20)
$button_1 = GUISetControl("button", "Go", 150,200, 30,30)

GuiShow()

While 1
    sleep(100)
    $msg = GuiMsg(0)
    Select
    Case $msg = -3
  Exit
    Case $msg = $input_1
    ;;;
    Case $msg = $radio_1
    ;;;
    Case $msg = $radio_2
    ;;;
    Case $msg = $radio_3
    ;;;
    Case $msg = $radio_4
    ;;;
    Case $msg = $radio_5
    ;;;
    Case $msg = $button_1
    ;;;
    EndSelect
WEnd
Exit

Share this post


Link to post
Share on other sites



I've created an example that works for one search engine. You will need to make a couple modifications to make it do what you want:

  • Change the hardcoded path to point to your browser for the Run command.
  • Add in the URL's to the other engines. I had the google one handy since it's part of my proxy configuration. Just use the source for the web pages to figure out what you need to put.
Here's the code:

#include <GuiConstants.au3>
Opt("GuiNotifyMode", 1)

GuiCreate("Internet Search", 200, 90)
  GuiSetControl("label", "Search term:", 0, 0, 50, 40)
  $input = GuiSetControl("input", "", 50, 5, 150, 20)
    GuiSetControlEx(-1, $GUI_FOCUS);set focus to the input prompt
  $engine1 = GuiSetControl("radio", "Google", 0, 30, 60, 20)
    GuiSetControlEx(-1, $GUI_CHECKED);check google by default
  $engine2 = GuiSetControl("radio", "Yahoo", 60, 30, 60, 20)
  $engine3 = GuiSetControl("radio", "AltaVista", 120, 30, 60, 20)
  $engine4 = GuiSetControl("radio", "Search.com", 20, 50, 80, 20)
  $engine5 = GuiSetControl("radio", "Ask Jeeves", 100, 50, 80, 20)
  $go = GuiSetControl("button", "Go", 160, 70, 40, 20)
    GuiSetControlEx(-1, $GUI_DEFBUTTON);if you press enter in the search box,
                                       ;this will press "go" for you
GuiShow()

While 1
  Sleep(100)
  $msg = GuiMsg()
  If $msg = -3 Then Exit
  If $msg = $go Then
   ;First, we need to figure out which engine was requested and create the URL.
   ;Because i only know the one for google, you'll have to find the rest out
     ;for yourself (just look at the HTML source for each of your engines.)
   ;Just un-comment my lines to add in support for the other engines.
    $term = GuiRead($input);get the text the user entered
    If BitAnd(GuiRead($engine1), $GUI_CHECKED) Then _
      $url = "http://www.google.com/search?q=" & $term
   ;If BitAnd(GuiRead($engine2), $GUI_CHECKED) Then _
   ;  $url =
   ;If BitAnd(GuiRead($engine3), $GUI_CHECKED) Then _
   ;  $url =
   ;If BitAnd(GuiRead($engine4), $GUI_CHECKED) Then _
   ;  $url =
   ;If BitAnd(GuiRead($engine5), $GUI_CHECKED) Then _
   ;  $url =

   ;CHANGE THIS LINE TO POINT TO YOUR BROWSER!!!
    Run('"c:\program files\firefox\firefox.exe" ' & $url)
    Exit
  EndIf
WEnd

Please note: this will crash if you use a browser other than google without adding in support for it.


[font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.

Share this post


Link to post
Share on other sites

Thank you , it will give me something to play with ..

Share this post


Link to post
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
Sign in to follow this  
Followers 0