Sign in to follow this  
Followers 0
cad29

How to used Combo

5 posts in this topic

Hi can anyone please help me with the script that i have on here what i have to do is is when you select the State example Michigan then when the time you press ok it will display a box saying you selected Michigan

this is the scrip that i have

#include <GuiConstants.au3>

GUICreate("State And Zip", 300, 200, -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$Combo_1 = GUICtrlCreateCombo("Choose Your State", 30, 30, 240, 21, BitOR($CBS_DROPDOWNLIST, $WS_VSCROLL))

GUICtrlSetData(-1, "Alabama")

GUICtrlSetData(-1, "Alaska")

GUICtrlSetData(-1, "Arizona")

GUICtrlSetData(-1, "Arkansas")

GUICtrlSetData(-1, "California")

GUICtrlSetData(-1, "Colorado")

GUICtrlSetData(-1, "Connecticut")

GUICtrlSetData(-1, "Delaware")

GUICtrlSetData(-1, "District of Columbia")

GUICtrlSetData(-1, "Florida")

GUICtrlSetData(-1, "Georgia")

GUICtrlSetData(-1, "Hawaii")

GUICtrlSetData(-1, "Idaho")

GUICtrlSetData(-1, "Illinois")

GUICtrlSetData(-1, "Indiana")

GUICtrlSetData(-1, "Iowa")

GUICtrlSetData(-1, "Kansas")

GUICtrlSetData(-1, "Kentucky")

GUICtrlSetData(-1, "Louisiana")

GUICtrlSetData(-1, "Maine")

GUICtrlSetData(-1, "Maryland")

GUICtrlSetData(-1, "Massachusetts")

GUICtrlSetData(-1, "Michigan")

GUICtrlSetData(-1, "Minnesota")

GUICtrlSetData(-1, "Mississippi")

GUICtrlSetData(-1, "Missouri")

GUICtrlSetData(-1, "Montana")

GUICtrlSetData(-1, "Nebraska")

GUICtrlSetData(-1, "Nevada")

GUICtrlSetData(-1, "New Hampshire")

GUICtrlSetData(-1, "New Jersey")

GUICtrlSetData(-1, "New Mexico")

GUICtrlSetData(-1, "New York")

GUICtrlSetData(-1, "North Carolina")

GUICtrlSetData(-1, "North Dakota")

GUICtrlSetData(-1, "Ohio")

GUICtrlSetData(-1, "Oklahoma")

GUICtrlSetData(-1, "Oregon")

GUICtrlSetData(-1, "Pennsylvania")

GUICtrlSetData(-1, "Rhode Island")

GUICtrlSetData(-1, "South Carolina")

GUICtrlSetData(-1, "South Dakota")

GUICtrlSetData(-1, "Tennessee")

GUICtrlSetData(-1, "Texas")

GUICtrlSetData(-1, "Utah")

GUICtrlSetData(-1, "Vermont")

GUICtrlSetData(-1, "Virginia")

GUICtrlSetData(-1, "Washington")

GUICtrlSetData(-1, "West Virginia")

GUICtrlSetData(-1, "Wisconsin")

GUICtrlSetData(-1, "Wyoming")

GUICtrlRead($Combo_1)

$Combo_2 = GUICtrlCreateCombo("Choose Your Zip Code", 30, 81, 240, 21, BitOR($CBS_DROPDOWNLIST, $WS_VSCROLL))

$item = $Combo_1

$Button_3 = GUICtrlCreateButton("OK", 80, 140, 130, 40)

GUISetState()

While 1

$msg = GUIGetMsg()

Select

Case $msg = $GUI_EVENT_CLOSE

ExitLoop

EndSelect

WEnd

Please add something in my script to make it work when the time he selected Wyoming or Michigan and you press ok it will display that you selected Michigan

Share this post


Link to post
Share on other sites



#include <GuiConstants.au3>
GUICreate("State And Zip", 300, 200, -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
$Combo_1 = GUICtrlCreateCombo("Choose Your State", 30, 30, 240, 21, BitOR($CBS_DROPDOWNLIST, $WS_VSCROLL))
GUICtrlSetData(-1, "Alabama")
GUICtrlSetData(-1, "Alaska")
GUICtrlSetData(-1, "Arizona")
GUICtrlSetData(-1, "Arkansas")
GUICtrlSetData(-1, "California")
GUICtrlSetData(-1, "Colorado")
GUICtrlSetData(-1, "Connecticut")
GUICtrlSetData(-1, "Delaware")
GUICtrlSetData(-1, "District of Columbia")
GUICtrlSetData(-1, "Florida")
GUICtrlSetData(-1, "Georgia")
GUICtrlSetData(-1, "Hawaii")
GUICtrlSetData(-1, "Idaho")
GUICtrlSetData(-1, "Illinois")
GUICtrlSetData(-1, "Indiana")
GUICtrlSetData(-1, "Iowa")
GUICtrlSetData(-1, "Kansas")
GUICtrlSetData(-1, "Kentucky")
GUICtrlSetData(-1, "Louisiana")
GUICtrlSetData(-1, "Maine")
GUICtrlSetData(-1, "Maryland")
GUICtrlSetData(-1, "Massachusetts")
GUICtrlSetData(-1, "Michigan")
GUICtrlSetData(-1, "Minnesota")
GUICtrlSetData(-1, "Mississippi")
GUICtrlSetData(-1, "Missouri")
GUICtrlSetData(-1, "Montana")
GUICtrlSetData(-1, "Nebraska")
GUICtrlSetData(-1, "Nevada")
GUICtrlSetData(-1, "New Hampshire")
GUICtrlSetData(-1, "New Jersey")
GUICtrlSetData(-1, "New Mexico")
GUICtrlSetData(-1, "New York")
GUICtrlSetData(-1, "North Carolina")
GUICtrlSetData(-1, "North Dakota")
GUICtrlSetData(-1, "Ohio")
GUICtrlSetData(-1, "Oklahoma")
GUICtrlSetData(-1, "Oregon")
GUICtrlSetData(-1, "Pennsylvania")
GUICtrlSetData(-1, "Rhode Island")
GUICtrlSetData(-1, "South Carolina")
GUICtrlSetData(-1, "South Dakota")
GUICtrlSetData(-1, "Tennessee")
GUICtrlSetData(-1, "Texas")
GUICtrlSetData(-1, "Utah")
GUICtrlSetData(-1, "Vermont")
GUICtrlSetData(-1, "Virginia")
GUICtrlSetData(-1, "Washington")
GUICtrlSetData(-1, "West Virginia")
GUICtrlSetData(-1, "Wisconsin")
GUICtrlSetData(-1, "Wyoming")
GUICtrlRead($Combo_1)
$Combo_2 = GUICtrlCreateCombo("Choose Your Zip Code", 30, 81, 240, 21, BitOR($CBS_DROPDOWNLIST, $WS_VSCROLL))
$item = $Combo_1
$Button_3 = GUICtrlCreateButton("OK", 80, 140, 130, 40)
GUISetState()

While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $Button_3
    MsgBox(0,"You chose", GUICtrlRead( $Combo_1 ))
EndSelect
WEnd



Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

You beat me BigDod cause i was shortening his code

#include <GuiConstants.au3>
GUICreate("State And Zip", 300, 200, -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
$Combo_1 = GUICtrlCreateCombo("Choose Your State", 30, 30, 240, 21, BitOR($CBS_DROPDOWNLIST, $WS_VSCROLL))
GUICtrlSetData($Combo_1, "Alabama|Alaska|Arizona|Arkansas|California|Colorado|Connecticut|Delaware|"& _
"District of Columbia|Florida|Georgia|Hawaii|Idaho|Michigan", "Choose Your State");add all states here separated by pipes "|"

$Combo_2 = GUICtrlCreateCombo("Choose Your Zip Code", 30, 81, 240, 21, BitOR($CBS_DROPDOWNLIST, $WS_VSCROLL))
$item = $Combo_1;what is the purpose of this?
$Button_3 = GUICtrlCreateButton("OK", 80, 140, 130, 40)
GUISetState()

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $Button_3 
            Go()
    EndSelect
WEnd

Func Go()
$State = GUICtrlRead($Combo_1)
$Zip = GUICtrlRead($Combo_2)
MsgBox(0, "You pushed OK", "You Selected: "&@CRLF&"State: "&$State&@CRLF&"Zip: "&$Zip)
EndFunc

Share this post


Link to post
Share on other sites

Hi BigDod and Pauline thanks a lot guys it work thanks for your help i appreciated it sooo muchhh take care always

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Hi BigDod and Paulie thanks a lot guys it work thanks for your help i appreciated it sooo muchhh take care always

Sure, no problem, glad i could help

P.S.- my name is 'Paulie', with no 'n' lol

:P

Edited by Paulie

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