Jump to content

Recommended Posts

Posted

Hello all, Im new to the software and this site. I think it is awesome lol. Ive been reading the help document all day. However I have a question. I am trying to have a drop down box with a list of lets say 10 options. When the user selects from the drop down box, Whatever is selected is passed into IE and is used as the keyword in google. I have everything else down except setting up the drop down box and passing it to google. Any ideas on how to do this? Please and Thanks.

Posted (edited)

You could use GUICtrlCreateCombo, to create drop down selection. To read selected data from combo box you could just call GuiCtrlRead and save it to some variable. For example:

#include <GUIConstants.au3>

Opt("GUIOnEventMode", 1)
$hwnd = GUICreate ("Web Browser", 200, 200)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
$combo = GUICtrlCreateCombo("", 5, 5, 100, 20)
GUICtrlSetData(-1, "item1|item2|item3", "item1")
GUICtrlSetOnEvent($combo, "_Selected")
GUISetState(@SW_SHOW)

While 1
    Sleep(50)
WEnd

Func _Selected()
    $Selection = GuiCtrlRead($combo)
    MsgBox(0, "Selection...", "Selected item: " & $Selection)
EndFunc
Func _Exit()
    Exit
EndFunc
Edited by Makaule
Posted

You could use GUICtrlCreateCombo, to create drop down selection. To read selected data from combo box you could just call GuiCtrlRead and save it to some variable. For example:

#include <GUIConstants.au3>

Opt("GUIOnEventMode", 1)
$hwnd = GUICreate ("Web Browser", 200, 200)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
$combo = GUICtrlCreateCombo("", 5, 5, 100, 20)
GUICtrlSetData(-1, "item1|item2|item3", "item1")
GUICtrlSetOnEvent($combo, "_Selected")
GUISetState(@SW_SHOW)

While 1
    Sleep(50)
WEnd

Func _Selected()
    $Selection = GuiCtrlRead($combo)
    MsgBox(0, "Selection...", "Selected item: " & $Selection)
EndFunc
Func _Exit()
    Exit
EndFunc

Thanks for the response. In my code I had _IENavigate($oIE,"http://resultfromdropdown.somesite.com/?q="something")

oIE is an embedded window. My question is how would i place the result returned from the dropdown to replace "resultfromdropdown

Posted

Try this, if you change item1, item2, item3 to normal adresses, like http://www.google.com:

Func _Selected()
    $Selection = GuiCtrlRead($combo)
    _IENavigate($oIE, $Selection)
EndFunc

or

this, if you want to surf on same website, just different place, lets say place1.htm, place2.htm and etc.:

Func _Selected()
    $Selection = "http://www.something.com/" & GuiCtrlRead($combo)
    _IENavigate($oIE, $Selection)
EndFunc

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
  • Recently Browsing   0 members

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