AutoIT GUI macht sich selbständig

  • Hallo,

    ich habe ein Problem. Die Hilfe und Suche benütze ich nun seit heute Nachmittag, aber ohne nennenswerten Erfolg.

    Mein Problem ist, wenn ich meine Form starte, dass dann alles schon beginnt, obwohl ich noch nicht den Start Button gedrückt habe. Wenn ich auf Stop klicke, dann beendet sich das Programm.

    Ich habe leider keine Idee, wie ich das machen muss, damit das Programm erst funktioniert, wenn ich den Start Button drücke.

    Hier der Code der Form:

    [autoit]

    #Region ### START Koda GUI section ### Form=
    $cxb = GUICreate("CXB", 164, 148, 413, 286)
    $start = GUICtrlCreateButton("Start", 16, 56, 129, 33, 0)
    $exit = GUICtrlCreateButton("Stop", 16, 96, 129, 33, 0) ;das is der 2.te button
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

    [/autoit]

    Und hier der Code vom "wichtigsten":

    [autoit]

    Func _cxb()
    $runstotal = 15
    $runs = 0
    While 1
    Select
    Case $runstotal <> $runs
    $runs = $runs + 1
    _f();
    Case $runstotal = $runs
    $runs = $runs - 15
    _gh()
    _g()
    _i()
    _t();
    EndSelect
    WEnd
    EndFunc

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $start
    _cxb()
    Case $exit
    _exitit()
    EndSwitch
    WEnd

    [/autoit]
  • Du hast glaube ich die includes vergessen

    Ich weiss jetzt nicht genau welche du brauchst als nehme ich im folgenden einfach mal alle her die ich benutze

    Spoiler anzeigen
    [autoit]

    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <ComboConstants.au3>
    #include <ListViewConstants.au3>
    #include <StaticConstants.au3>
    #include <ButtonConstants.au3>
    #include <ListBoxConstants.au3>
    #include <TabConstants.au3>
    #include <EditConstants.au3>
    #include <DateTimeConstants.au3>
    #include <SliderConstants.au3>
    #include <TreeViewConstants.au3>
    #include <ProgressConstants.au3>
    #include <AVIConstants.au3>
    #include <UpDownConstants.au3>
    #include<Array.au3>
    #include<File.au3>
    #include <WinAPI.au3>
    #include-once
    #NoTrayIcon

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

    #Region ### START Koda GUI section ### Form=
    $cxb = GUICreate("CXB", 164, 148, 413, 286)
    $start = GUICtrlCreateButton("Start", 16, 56, 129, 33, 0)
    $exit = GUICtrlCreateButton("Stop", 16, 96, 129, 33, 0) ;das is der 2.te button
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $start
    _cxb()
    Case $exit
    _exitit()
    EndSwitch
    WEnd

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

    Func _cxb()
    $runstotal = 15
    $runs = 0
    While 1
    Select
    Case $runstotal <> $runs
    $runs = $runs + 1
    _f();
    Case $runstotal = $runs
    $runs = $runs - 15
    _gh()
    _g()
    _i()
    _t();
    EndSelect
    WEnd
    EndFunc

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

    Func _exitit()
    Exit
    EndFunc

    [/autoit]

    so geht es problemfrei

    Mfg LogiVidia

  • [autoit]

    #include <GUIConstants.au3>

    [/autoit]

    Das steht schon oben, das ist es nicht.

    Das Programm soll einfach erst mal starten. Ich habe dann eine ganz normale Oberfläche wie es eben in fast allen Programmen so ist. Danach will ich, wenn ich auf Start klicke, dass erst dann alles läuft. Später kommen noch mehr Funktionen hinzu.

  • ich rieche einen bot :D

    MfG Schnuffel

    "Sarkasmus ist die niedrigste Form des Witzes, aber die höchste Form der Intelligenz."
    Val McDermid

    ein paar Infos ...

    Wer mehr als "nur" Hilfe benötigt, kann sich gern im Forum "Programmieranfragen" an uns wenden. Wir helfen in allen Fällen, die die Forenregeln zulassen.

    Für schnelle Hilfe benötigen wir ein ! lauffähiges ! Script, dass wir als Demonstration des Problems testen können. Wer von uns erwartet ein Teilscript erstmal lauffähig zu bekommen, der hat
    1. keine wirkliche Not
    2. keinen Respekt vor Menschen die ihm in ihrer Freizeit Ihre Hilfe anbieten
    3. oder ist einfach nur faul und meint wir coden das für ihn

    In solchen Fällen erlaube ich mir, die Anfrage einfach zu ignorieren. ;)

  • ja bei ihm wird die funktion aber schon direkt nach start der gui ausgeführt ohne auf einen button klick zu achten

    So geht es bei mir ebenfalls einwandfrei

    Spoiler anzeigen
    [autoit][/autoit] [autoit][/autoit] [autoit]

    #include <GUIConstants.au3>

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

    #Region ### START Koda GUI section ### Form=
    $cxb = GUICreate("CXB", 164, 148, 413, 286)
    $start = GUICtrlCreateButton("Start", 16, 56, 129, 33, 0)
    $exit = GUICtrlCreateButton("Stop", 16, 96, 129, 33, 0) ;das is der 2.te button
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

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

    Func _cxb()
    $runstotal = 15
    $runs = 0
    While 1
    Select
    Case $runstotal <> $runs
    $runs = $runs + 1
    _f();
    Case $runstotal = $runs
    $runs = $runs - 15
    _gh()
    _g()
    _i()
    _t();
    EndSelect
    WEnd
    EndFunc

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $start
    _cxb()
    Case $exit
    _exitit()
    EndSwitch
    WEnd

    [/autoit]
  • dass es ohne die restlichen funktioniert stelle ich auch eben fest, aber wo würde da der sinn bleiben? *g*

    ich meine, muss ich vlt die _cxb() funktion in die while schleife einbauen?