Jump to content

Search Help


cad29
 Share

Recommended Posts

Hi i need help in my script i want to add a Search button on this script aside from the dropdownlist menu once you type something in the search button it will autopopulate in the dropdownlist aswell example if you type letter south and you hit enter then automatically the dropdownlist will display South Carolina any help will be appreciated heres my little script thanks

#include <GuiConstants.au3>

#include <IE.au3>

#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)

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

GUISetState()

While 1

$msg = GUIGetMsg()

Select

Case $msg = $GUI_EVENT_CLOSE

ExitLoop

Case Else

If $msg = $Button_3 Then

$City = GUICtrlRead($Combo_1)

MsgBox(0,"City","You selected " & $City)

EndIf

EndSelect

WEnd

Exit

Link to comment
Share on other sites

Give this a whirl...

#include <GuiConstants.au3>
#Include <GuiCombo.au3>

Opt('GUIOnEventMode', 1)

Dim $states[52] = [51, "Alabama", "Alaska", "Arizona", "Arkansas", "California", "Colorado", "Connecticut", _
        "Delaware", "District of Columbia", "Florida", "Georgia", "Hawaii", "Idaho", "Illinois", "Indiana", "Iowa", _
        "Kansas", "Kentucky", "Louisiana", "Maine", "Maryland", "Massachusetts", "Michigan", "Minnesota", "Mississippi", _
        "Missouri", "Montana", "Nebraska", "Nevada", "New Hampshire", "New Jersey", "New Mexico", "New York", "North Carolina", _
        "North Dakota", "Ohio", "Oklahoma", "Oregon", "Pennsylvania", "Rhode Island", "South Carolina", "South Dakota", _
        "Tennessee", "Texas", "Utah", "Vermont", "Virginia", "Washington", "West Virginia", "Wisconsin", "Wyoming"]

GUICreate("State And Zip", 300, 200)
GUISetOnEvent($GUI_EVENT_CLOSE, 'quit')

$Combo_1 = GUICtrlCreateCombo("Choose Your State", 30, 30, 240, 200, $CBS_DROPDOWNLIST + $WS_VSCROLL)

$input = GUICtrlCreateInput('', 30, 70, 240, 20)

For $i = 1 To UBound($states) - 1
    GUICtrlSetData($Combo_1, $states[$i])
Next

$Button_3 = GUICtrlCreateButton("OK", 80, 140, 130, 40)
GUICtrlSetOnEvent($Button_3, 'btn3')
GUICtrlSetState($Button_3, $GUI_DEFBUTTON)

GUISetState()

While 1
    If GUICtrlRead($input) <> '' Then
        _GUICtrlComboSelectString($Combo_1, 0, StringStripWS(GUICtrlRead($input), 3))
    EndIf
    Sleep(100)
WEnd

Func btn3()
    $City = GUICtrlRead($Combo_1)
    If Not StringInStr($City, 'Choose') Then
        MsgBox(0, "City", "You selected " & $City)
    EndIf
EndFunc

Func quit()
    Exit
EndFunc

edit - stripws, removed some extra crap, fixed style

Edited by xcal
Link to comment
Share on other sites

hi xcal or anybody can answer this one this script that xcal gave to me works fine but once i hit the arry of 200 it doesnt work anymore if my script will be like this Dim $states[201] = [200 ........ and then when i run the program it gives me an error of : ==> Error in expression.: anyhelp will be appreciated thanks a lot

Link to comment
Share on other sites

hi xcal or anybody can answer this one this script that xcal gave to me works fine but once i hit the arry of 200 it doesnt work anymore if my script will be like this Dim $states[201] = [200 ........ and then when i run the program it gives me an error of : ==> Error in expression.: anyhelp will be appreciated thanks a lot

a single AU3 script line has a limit of 4095 chars! BTW: _ just concatenates multiple lines in your script to ONE line!

Cheers

Kurt

Edited by /dev/null

__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Link to comment
Share on other sites

why would you need 200 States???

Maybe he counted the "new" States in Afghanistan, Iraq and soon Iran as well. ;)

Cheers

Kurt

__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

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...