Problem Button Befehl

  • Hallo,

    ich habe nun das Problem, dass ich nachdem ein Button angeklickt wurde, dass sich dann eine neue Gui öffnen soll.

    Nachdem er dort ein Button angeklickt hat, soll er die Befehle dafür ausführen.

    Kann mir da bitte jemand helfen?

    Script :

    Spoiler anzeigen

    #include <ButtonConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>

    $Form1_1 = GUICreate("Event Helping Tool", 551, 441, 218, 17)
    $Event1 = GUICtrlCreateButton("v1", 8, 128, 137, 25, $WS_GROUP)
    $Event2 = GUICtrlCreateButton("v4", 8, 304, 137, 25, $WS_GROUP)
    $Event3 = GUICtrlCreateButton("v3", 8, 248, 137, 25, $WS_GROUP)
    $Event4 = GUICtrlCreateButton("v5", 8, 368, 137, 25, $WS_GROUP)
    $Event = GUICtrlCreateButton("v2", 8, 184, 137, 25, $WS_GROUP)
    $Pic1 = GUICtrlCreatePic("Aussehen.jpg", 0, 0, 550, 440, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
    GUISetState(@SW_SHOW)

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Event
    #include <ButtonConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>
    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("Form1", 288, 82, 192, 124)
    $Button1 = GUICtrlCreateButton("Test1", 8, 40, 97, 33, $WS_GROUP)
    $Button2 = GUICtrlCreateButton("Test2", 176, 40, 97, 33, $WS_GROUP)
    $Pic1 = GUICtrlCreatePic("Test.jpg", 0, 0, 300, 100, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###
    EndSwitch
    WEnd

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Button1

    MsgBox(64, "Test", "Test")
    sleep (10000)
    send ("{ENTER}")
    sleep (300)
    send ("Test")
    sleep (300)
    send ("{ENTER}")
    sleep (7000)
    send ("{ENTER}")

    EndSwitch
    WEnd

    Func _Start()

    EndFunc

    Func _Exit()

    EndFunc

  • Hi,
    1. Die Logik ist noch ein bisschen durcheinander, aber im Grunde...
    Ich würde beiden Guis am Anfang erstellen, und die eine durch @SW_HIDE unsichtbar machen.
    und dann in einer Funktion sichtbar machen.
    2.Das includen macht mitten im Code wenig Sinn.
    3. Die Zwei While Schleifen direkt untereinander machen so wie sie sind keinen Sinn, aber fast ;)
    Von Daher mein Vorschlag (Wenn du es nicht selber rausfinden willst :P):

    Spoiler anzeigen
    [autoit]

    #include <ButtonConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>

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

    $Form1_1 = GUICreate("Event Helping Tool", 551, 441, 218, 17)
    $Event1 = GUICtrlCreateButton("v1", 8, 128, 137, 25, $WS_GROUP)
    $Event2 = GUICtrlCreateButton("v4", 8, 304, 137, 25, $WS_GROUP)
    $Event3 = GUICtrlCreateButton("v3", 8, 248, 137, 25, $WS_GROUP)
    $Event4 = GUICtrlCreateButton("v5", 8, 368, 137, 25, $WS_GROUP)
    $Event = GUICtrlCreateButton("v2", 8, 184, 137, 25, $WS_GROUP)
    $Pic1 = GUICtrlCreatePic("Aussehen.jpg", 0, 0, 550, 440, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
    GUISetState(@SW_SHOW)

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

    $Form1 = GUICreate("Form1", 288, 82, 192, 124)
    $Button1 = GUICtrlCreateButton("Test1", 8, 40, 97, 33, $WS_GROUP)
    $Button2 = GUICtrlCreateButton("Test2", 176, 40, 97, 33, $WS_GROUP)
    $Pic1 = GUICtrlCreatePic("Test.jpg", 0, 0, 300, 100, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
    GUISetState(@SW_HIDE)
    While 1
    $nMsg = GUIGetMsg($Form1_1)
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Event
    _ShowGUI()
    EndSwitch
    WEnd
    Func _ShowGui()
    GuiSetState(@SW_SHOW, $Form1)
    While 1
    $nMsg = GUIGetMsg($Form1)
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    GuiSetState(@SW_HIDE, $Form1)
    ExitLoop
    Case $Button1
    MsgBox(64, "Test", "Test")
    sleep (10000)
    send ("{ENTER}")
    sleep (300)
    send ("Test")
    sleep (300)
    send ("{ENTER}")
    sleep (7000)
    send ("{ENTER}")
    EndSwitch
    WEnd
    EndFunc
    Func _Start()

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

    EndFunc

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

    Func _Exit()

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

    EndFunc

    [/autoit]