2 While Schleifen

  • Hallo,
    wie bekomme ich das unten stehende Script zum Laufen?
    Ich weiß nicht, wie man mit den beiden While-Schleifen umgeht.

    Danke

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

    #include <GUIConstantsEx.au3>

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

    $mainwindow = GUICreate("Hello World", 400, 400)
    GUICtrlCreateLabel("Hello world! How are you?", 30, 10)
    $okbutton = GUICtrlCreateButton("OK", 70, 50, 60)

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

    $dummywindow = GUICreate("Dummy window for testing ", 200, 100)

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

    GUISwitch($mainwindow)
    GUISetState(@SW_SHOW)

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

    $combo = GUICtrlCreateCombo("", 300, 225+5, 80)
    GUICtrlSetData(-1, "Google|Yahoo")
    $label=GUICtrlCreateLabel("", 100, 100, 200, 20)

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

    While True
    Switch GUIGetMsg()
    Case $combo
    _combo()
    Endswitch
    WEnd

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

    Func _combo()
    $read = GUICtrlRead($combo)
    If $read = "Google" Then $page = "http://www.google.de"
    If $read = "Yahoo" Then $page = "http://www.yahoo.de"
    GUICtrlSetData($label,$page)
    EndFunc

    While 1
    $msg = GUIGetMsg(1)

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

    Select
    Case $msg[0] = $okbutton
    MsgBox(0, "GUI Event", "You pressed OK!")

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

    Case $msg[0] = $GUI_EVENT_CLOSE And $msg[1] = $mainwindow
    MsgBox(0, "GUI Event", "You clicked CLOSE on the main window! Exiting...")
    ExitLoop
    EndSelect
    WEnd

    [/autoit]

    Einmal editiert, zuletzt von Root (17. April 2009 um 12:42)

  • Die Functionen müssen immer ganz nach unten und mit while truee und while muss es auch noch was geben um eines zu machen aber ich weis jetzt nicht wie!

  • [autoit]

    #include <GUIConstantsEx.au3>

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

    $mainwindow = GUICreate("Hello World", 400, 400)
    GUICtrlCreateLabel("Hello world! How are you?", 30, 10)
    $okbutton = GUICtrlCreateButton("OK", 70, 50, 60)

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

    $dummywindow = GUICreate("Dummy window for testing ", 200, 100)

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

    GUISwitch($mainwindow)
    GUISetState(@SW_SHOW)

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

    $combo = GUICtrlCreateCombo("", 300, 225+5, 80)
    GUICtrlSetData(-1, "Google|Yahoo")
    $label=GUICtrlCreateLabel("", 100, 100, 200, 20)

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

    Func _combo()
    $read = GUICtrlRead($combo)
    If $read = "Google" Then $page = "http://www.google.de"
    If $read = "Yahoo" Then $page = "http://www.yahoo.de"
    GUICtrlSetData($label,$page)
    EndFunc

    While 1
    Switch GUIGetMsg()
    Case $combo
    _combo()
    Case $okbutton
    MsgBox(0, "GUI Event", "You pressed OK!")

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

    Case $GUI_EVENT_CLOSE And $msg[1] = $mainwindow
    MsgBox(0, "GUI Event", "You clicked CLOSE on the main window! Exiting...")
    ExitLoop
    EndSelect
    WEnd

    [/autoit]

    Twitter: @L3viathan2142
    Benutze AutoIt persönlich nicht mehr, da ich keinen Windows-Rechner mehr besitze.

  • Danke für den Tip
    So funzt es:

    [autoit]


    While 1
    $msg = GUIGetMsg(1)

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

    Select
    Case $msg[0] = $combo
    _combo()

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

    Case $msg[0] = $okbutton
    MsgBox(0, "GUI Event", "You pressed OK!")

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

    Case $msg[0] = $GUI_EVENT_CLOSE And $msg[1] = $mainwindow
    MsgBox(0, "GUI Event", "You clicked CLOSE on the main window! Exiting...")
    ExitLoop
    EndSelect
    WEnd

    [/autoit][autoit][/autoit][autoit][/autoit]
  • Also so geht es auch:

    Spoiler anzeigen
    [autoit]

    #include <GUIConstantsEx.au3>

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

    $mainwindow = GUICreate("Hello World", 400, 400)
    GUICtrlCreateLabel("Hello world! How are you?", 30, 10)
    $okbutton = GUICtrlCreateButton("OK", 70, 50, 60)

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

    $dummywindow = GUICreate("Dummy window for testing ", 200, 100)

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

    GUISwitch($mainwindow)
    $page = ""

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

    $combo = GUICtrlCreateCombo("", 300, 225+5, 80)
    $read = GUICtrlSetData(-1, "Google|Yahoo")
    $label=GUICtrlCreateLabel("", 100, 100, 200, 20)
    GUISetState(@SW_SHOW)

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

    _combo()

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

    Func _combo()
    $read = GUICtrlRead($combo)
    If $read = "Google" Then $page = "http://www.google.de"
    If $read = "Yahoo" Then $page = "http://www.yahoo.de"
    GUICtrlSetData($label,$page)
    EndFunc

    While 1
    $msg = GUIGetMsg(1)

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

    Select
    Case $msg[0] = $okbutton
    MsgBox(0, "GUI Event", "You pressed OK!")

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

    Case $msg[0] = $GUI_EVENT_CLOSE And $msg[1] = $mainwindow
    MsgBox(0, "GUI Event", "You clicked CLOSE on the main window! Exiting...")
    ExitLoop
    EndSelect
    WEnd

    [/autoit]

    Lieben Gruß,
    Alina

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    Geheime Information: ;)
    k3mrwmIBHejryPvylQSFieDF5f3VOnk6iLAVBGVhKQegrFuWr3iraNIblLweSW4WgqI0SrRbS7U5jI3sn50R4a15Cthu1bEr