blutiger Anfänger sucht hilfe mit der listbox :)

  • Hi
    ich code noch nicht all zu lange mit autoIT
    mein problem ist ich möchte gerne in mein GUImenu
    eine liste haben wo mann verschiedene Sachen auswählen kann
    und je nach dem ausgewählten text soll das script verschiedene sachen machen
    also hier ein beispiel
    ich wähle in der liste die 1 aus und starte das script
    dann soll das script zb. bild1 öffnen
    wenn ich 2 auswähle soll er bild2 öfnen usw

    ich hab die hilfe schon durchgelesen bekomme es aber nicht auf die reihe
    könnte mir vllt jmd sowas aufsetzen oder zumindest mal sagen wie ich das hinbekomme

    mfg Stealfighter :love:

  • hi,

    meinst du so etwa?

    Spoiler anzeigen
    [autoit]

    #include <GUIConstantsEx.au3>
    #include <ListBoxConstants.au3>
    #include <WindowsConstants.au3>

    [/autoit] [autoit][/autoit] [autoit]

    #Region ### START Koda GUI section ### Form=
    $Form3 = GUICreate("Form3", 264, 197, 410, 283)
    $List1 = GUICtrlCreateList("", 32, 40, 113, 84)
    GUICtrlSetData(-1, "item 1|item 2|item 3|item 4|item 5")
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

    [/autoit] [autoit][/autoit] [autoit]

    $lst_auswahlold = ""
    $lst_auswahl = ""

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    $nMsg = GUIGetMsg()

    $lst_auswahl = GUICtrlRead($List1)
    if $lst_auswahl <> $lst_auswahlold Then
    Select
    Case $lst_auswahl = "item 1"
    MsgBox(0,"",$lst_auswahl)

    Case $lst_auswahl = "item 2"
    MsgBox(0,"",$lst_auswahl)

    Case $lst_auswahl = "item 3"
    MsgBox(0,"",$lst_auswahl)

    Case $lst_auswahl = "item 4"
    MsgBox(0,"",$lst_auswahl)

    Case $lst_auswahl = "item 5"
    MsgBox(0,"",$lst_auswahl)
    EndSelect
    $lst_auswahlold = $lst_auswahl
    EndIf


    Switch $nMsg

    Case $GUI_EVENT_CLOSE
    Exit

    [/autoit] [autoit][/autoit] [autoit]

    EndSwitch
    WEnd

    [/autoit] [autoit][/autoit] [autoit][/autoit]

    gibt hunderte Lösungen, das ist eine ^^

    ---
    In "Independence Day" konnten die Windows-Erdcomputer problemlos mit denen der Außerirdischen kommunizieren. Was sagt uns das über unseren lieben Bill Gates? :D
    ---

  • ja das sieht recht ordentlich aus
    ich versuche mal was draus zu machen
    danke für die schnelle hilfe
    ein kleines problemchen hab ich allerdings noch
    geht das auch das man aus der liste was auswählt un das dann wie ne option wirkt
    also das das script das gleiche ist nur die liste ein paar kleinigkeiten verändert
    wie zb welches bild er öfnen soll
    es soll also noch nen start knopf geben oder sowas


    mfg Stealfighter

    Einmal editiert, zuletzt von stealfighter (13. Januar 2009 um 12:40)

    • Offizieller Beitrag

    oder so?

    Spoiler anzeigen
    [autoit]

    #include <GuiListBox.au3>
    #include <GUIConstantsEx.au3>
    #include <ListBoxConstants.au3>
    #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
    _Main()
    Func _Main()
    Local $hListBox, $text_B, $msg,$aItems,$sItems

    [/autoit] [autoit][/autoit] [autoit]

    GUICreate("List Box Get Text", 430, 350)
    $hListBox = GUICtrlCreateList("", 2, 2, 396, 296, BitOR($LBS_STANDARD, $LBS_EXTENDEDSEL))
    $text_B = GUICtrlCreateButton('Text anzeigen', 10, 300, 100, 20)
    GUISetState()

    [/autoit] [autoit][/autoit] [autoit]

    _GUICtrlListBox_BeginUpdate($hListBox)
    For $iI = 1 To 9
    _GUICtrlListBox_AddString($hListBox, StringFormat("%03d : Random string", Random(1, 100, 1)))
    Next
    _GUICtrlListBox_EndUpdate($hListBox)

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    $msg = GUIGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
    Exit (0)
    Case $msg = $text_B
    $aItems = _GUICtrlListBox_GetSelItemsText($hListBox)
    For $iI = 1 To $aItems[0]
    $sItems &= @LF & $aItems[$iI]
    Next
    MsgBox(4160, "Information", "Text: " & $sItems)
    $sItems = 0
    EndSelect
    WEnd
    GUIDelete()
    EndFunc ;==>_Main

    [/autoit]


    Mega

  • also
    das tool soll für unsren eigenen WOW server sein
    es soll den playern erleichtern sich einzuloggen also ist es kein bot^^(ich weis die hier verboten sind)
    das tool soll in etwa so aussehen das mann die serverliste hat ,darum ja auch die item liste
    dann ein startknöpfchen und 2zeilen für ID und PW

    funktionieren sollte es so
    ich gebe ID und PW ein und suche in der Liste meinen Server aus und drücke Start
    dann öffnet sich wow und gibt die daten ein (soweit komme ich) dann wählt es per mausklicks den server aus und drückt einter
    und tada der spieler ist eingelogt

  • meine methode umgebaut mit button. Das andere mit der Option versteh ich nicht, was du meinst.

    Spoiler anzeigen
    [autoit]

    #include <GUIConstantsEx.au3>

    [/autoit] [autoit][/autoit] [autoit]

    #Region ### START Koda GUI section ### Form=
    $Form3 = GUICreate("Form3", 257, 171, 411, 284)
    $List1 = GUICtrlCreateList("", 32, 40, 113, 84)
    GUICtrlSetData(-1, "item 1|item 2|item 3|item 4|item 5")
    $btn_go = GUICtrlCreateButton("go", 160, 96, 75, 25, 0)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    While 1
    $nMsg = GUIGetMsg()


    Switch $nMsg

    Case $GUI_EVENT_CLOSE
    Exit

    Case $btn_go
    $lst_auswahl = GUICtrlRead($List1)
    Select
    Case $lst_auswahl = "item 1"
    MsgBox(0,"",$lst_auswahl)

    Case $lst_auswahl = "item 2"
    MsgBox(0,"",$lst_auswahl)

    Case $lst_auswahl = "item 3"
    MsgBox(0,"",$lst_auswahl)

    Case $lst_auswahl = "item 4"
    MsgBox(0,"",$lst_auswahl)

    Case $lst_auswahl = "item 5"
    MsgBox(0,"",$lst_auswahl)
    EndSelect
    EndSwitch
    WEnd

    [/autoit] [autoit][/autoit] [autoit][/autoit]

    ---
    In "Independence Day" konnten die Windows-Erdcomputer problemlos mit denen der Außerirdischen kommunizieren. Was sagt uns das über unseren lieben Bill Gates? :D
    ---

  • ja das sieht recht ordentlich aus

    geht das auch das man aus der liste was auswählt un das dann wie ne option wirkt
    also das das script das gleiche ist nur die liste ein paar kleinigkeiten verändert

    mfg Stealfighter


    Meinst Du das vielleicht so??


    Spoiler anzeigen
    [autoit]

    #include <GUIConstantsEx.au3>

    [/autoit] [autoit][/autoit] [autoit]

    #Region ### START Koda GUI section ### Form=
    $Form3 = GUICreate("Form3", 257, 171, 411, 284)
    $List1 = GUICtrlCreateList("", 32, 40, 113, 84)
    GUICtrlSetData(-1, "item 1|item 2|item 3|item 4|item 5")
    $btn_go = GUICtrlCreateButton("go", 160, 96, 75, 25, 0)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    While 1
    $nMsg = GUIGetMsg()

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Switch $nMsg

    [/autoit] [autoit][/autoit] [autoit]

    Case $GUI_EVENT_CLOSE
    Exit

    [/autoit] [autoit][/autoit] [autoit]

    Case $btn_go
    $lst_auswahl = GUICtrlRead($List1)
    Select

    [/autoit] [autoit][/autoit] [autoit]

    Case $lst_auswahl = "item 1"
    $server = 1
    $server_icon = "wow1.jpg"
    func_login ($server,$server_icon)

    [/autoit] [autoit][/autoit] [autoit]

    Case $lst_auswahl = "item 2"
    $server = 2
    $server_icon = "wow2.jpg"
    func_login ($server,$server_icon)

    [/autoit] [autoit][/autoit] [autoit]

    EndSelect
    EndSwitch
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    func_login ($server,$server_icon)
    ;zeige Icon
    ;wähle Server
    endfunc

    [/autoit]
  • latemail der code kann so wohl nicht ganz funktionieren!

    wenn dann so:

    Spoiler anzeigen
    [autoit]

    #include <GUIConstantsEx.au3>

    [/autoit] [autoit][/autoit] [autoit]

    #Region ### START Koda GUI section ### Form=
    $Form3 = GUICreate("Form3", 257, 171, 411, 284)
    $List1 = GUICtrlCreateList("", 32, 40, 113, 84)
    GUICtrlSetData(-1, "item 1|item 2|item 3|item 4|item 5")
    $btn_go = GUICtrlCreateButton("go", 160, 96, 75, 25, 0)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    While 1
    $nMsg = GUIGetMsg()

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Switch $nMsg

    [/autoit] [autoit][/autoit] [autoit]

    Case $GUI_EVENT_CLOSE
    Exit

    [/autoit] [autoit][/autoit] [autoit]

    Case $btn_go
    $lst_auswahl = GUICtrlRead($List1)
    Select

    [/autoit] [autoit][/autoit] [autoit]

    Case $lst_auswahl = "item 1"
    $server = 1
    $server_icon = "wow1.jpg"
    _login ($server,$server_icon)

    [/autoit] [autoit][/autoit] [autoit]

    Case $lst_auswahl = "item 2"
    $server = 2
    $server_icon = "wow2.jpg"
    _login ($server,$server_icon)

    [/autoit] [autoit][/autoit] [autoit]

    EndSelect
    EndSwitch
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    func _login ($server,$server_icon)
    ;zeige Icon
    ;wähle Server
    endfunc

    [/autoit]

    ---
    In "Independence Day" konnten die Windows-Erdcomputer problemlos mit denen der Außerirdischen kommunizieren. Was sagt uns das über unseren lieben Bill Gates? :D
    ---

  • Spoiler anzeigen

    #include <GUIConstantsEx.au3>

    #Region ### START Koda GUI section ### Form=
    $Form3 = GUICreate("Autologin by Stealfighter", 257, 171, 411, 284)
    $List1 = GUICtrlCreateList("", 32, 40, 113, 84)
    GUICtrlSetData(-1, "item 1|item 2|item 3|item 4|item 5")
    $btn_go = GUICtrlCreateButton("go", 160, 96, 75, 25, 0)
    GUISetState(@SW_SHOW)
    $ID = GUICtrlCreateInput ("ID" ,160, 30)
    $PW = GUICtrlCreateInput ("PW" ,160, 60)
    #EndRegion ### END Koda GUI section ###


    While 1
    $nMsg = GUIGetMsg()


    Switch $nMsg

    Case $GUI_EVENT_CLOSE
    Exit

    Case $btn_go
    $lst_auswahl = GUICtrlRead($List1)
    Select
    Case $lst_auswahl = "item 1"
    $name = GUICtrlRead($ID)
    $pwd = GUICtrlRead($PW)
    Run("Client")
    WinWait("ClientUpdate")
    MouseClick("left",788,652)
    Sleep(15000)
    MouseClickDrag("left",755,633,755,633,3000)
    Sleep(5000)

    Send($name)
    Send("{TAB}")
    Sleep(2000)
    Send($pwd)
    Send("{Enter}")
    Sleep(3000)
    MouseClick("left",694,195)
    Send("{Enter}")


    Case $lst_auswahl = "item 2"
    MsgBox(0,"",$lst_auswahl)

    Case $lst_auswahl = "item 3"
    MsgBox(0,"",$lst_auswahl)

    Case $lst_auswahl = "item 4"
    MsgBox(0,"",$lst_auswahl)

    Case $lst_auswahl = "item 5"
    MsgBox(0,"",$lst_auswahl)
    EndSelect
    EndSwitch
    WEnd

    bis jetz bin ich mal soweit nur
    er gibt die daten zu schnell ein da kommt nur die hälfte im fenster an

  • [autoit]

    #include <GUIConstantsEx.au3>

    [/autoit][autoit][/autoit][autoit]

    #Region ### START Koda GUI section ### Form=
    $Form3 = GUICreate("Form3", 257, 171, 411, 284)
    $List1 = GUICtrlCreateList("", 32, 50, 113, 84)
    GUICtrlSetData(-1, "item 1|item 2|item 3|item 4|item 5")
    $btn_go = GUICtrlCreateButton("go", 160, 96, 75, 25, 0)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###
    $ID_Field = GUICtrlCreateInput("", 35, 5, 50, 20)
    $Pass_Field = GUICtrlCreateInput("", 35, 25, 50, 20)
    Dim $Server
    While 1
    $nMsg = GUIGetMsg()


    Switch $nMsg

    Case $GUI_EVENT_CLOSE
    Exit

    Case $btn_go
    $lst_auswahl = GUICtrlRead($List1)
    Select
    Case $lst_auswahl = "item 1"
    $Server = 'Server1'

    Case $lst_auswahl = "item 2"
    $Server = 'Server2'

    Case $lst_auswahl = "item 3"
    $Server = 'Server3'

    Case $lst_auswahl = "item 4"
    $Server = 'Server4'

    Case $lst_auswahl = "item 5"
    $Server = 'Server5'

    EndSelect
    $ID = GUICtrlRead($ID_Field)
    $Pass = GUICtrlRead($Pass_Field)
    if $ID AND $Pass AND $Server Then _LoginServer($Server, $ID, $Pass)
    EndSwitch
    WEnd

    [/autoit][autoit][/autoit][autoit]

    Func _LoginServer($Server, $ID, $Pass)
    msgbox(0,'', 'Connect to Server: ' & $Server & @CRLF & 'with ID: ' & $ID & @CRLF & 'and Password: ' & $Pass)
    EndFunc

    [/autoit]


    Edith: Nochmal bissl aufgehübscht und mit Fehlerabfrage versehen

    Einmal editiert, zuletzt von mehrsolala (13. Januar 2009 um 15:12)

    • Offizieller Beitrag

    Xeno hat dir doch schon geschrieben schau dir mal AutoitSetOption oder kurz OPT in der Hilfe an. Schlagwort SendKeyDelay und bastel mal selber . Dann lernst du was .

  • Sry Raupi ich hab den post von Xeno nicht gesehen :love: :S
    naja danke mal für die hilfe bin mitlerweile fast fertig trotzdem 5tage ski fahrn