Hilfe

  • hallo leute,
    ich hab neu mit autoit angefangen===> hab ich kene ahnung.
    so sollte mal ersmal ein kleines fenster erstellen mit 2 freihen zeilenum was rein zu schreiben und 1 ok button.Es kommt aber immer der fehler variable cannot used before declaration.hier der code :

    Spoiler anzeigen

    #include <WindowsConstants.au3>
    #Region ### START Koda GUI section ### Form=
    $Form2 = GUICreate("Dialog", 349, 194, 306, 216)
    GUISetIcon("D:\009.ico")
    $Button3 = GUICtrlCreateButton("OK", 272, 88, 73, 41)
    $Input1 = GUICtrlCreateInput("Input1", 40, 24, 81, 21)
    GUICtrlSetBkColor(-1, 0xFFFFFF)
    $Input2 = GUICtrlCreateInput("Input2", 40, 56, 81, 21)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

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

    thx im voraus:D
    wenn ch das gelernt hab mit was soll ich fortfahren??

  • [autoit]

    Case $Button1

    [/autoit]

    da ist der fehler. du frägst quasi ab ob der $Button1 gedrückt wurde, obwohl du noch garkeinen $Button1 hast. du hast nur einen $Button3.

    du musst also am besten das hier:

    [autoit]

    $Button3 = GUICtrlCreateButton("OK", 272, 88, 73, 41)

    [/autoit]

    in das ändern:

    [autoit]


    [autoit]$Button1 = GUICtrlCreateButton("OK", 272, 88, 73, 41)

    [/autoit]

    [/autoit]

  • sorry baer immernoch das gleiche problem

    Spoiler anzeigen

    #include <WindowsConstants.au3>
    #Region ### START Koda GUI section ### Form=
    $Form2 = GUICreate("Dialog", 349, 194, 306, 216)
    GUISetIcon("D:\009.ico")
    $Button1 = GUICtrlCreateButton("OK", 272, 88, 73, 41)
    $Input1 = GUICtrlCreateInput("Input1", 40, 24, 81, 21)
    GUICtrlSetBkColor(-1, 0xFFFFFF)
    $Input2 = GUICtrlCreateInput("Input2", 40, 56, 81, 21)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

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

    • Offizieller Beitrag

    Falsches Include.

    Spoiler anzeigen
    [autoit]

    #include <GUIConstantsEx.au3>
    #Region ### START Koda GUI section ### Form=
    $Form2 = GUICreate("Dialog", 349, 194, 306, 216)
    GUISetIcon("D:\009.ico")
    $Button1 = GUICtrlCreateButton("OK", 272, 88, 73, 41)
    $Input1 = GUICtrlCreateInput("Input1", 40, 24, 81, 21)
    GUICtrlSetBkColor(-1, 0xFFFFFF)
    $Input2 = GUICtrlCreateInput("Input2", 40, 56, 81, 21)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

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

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

    [/autoit]
  • Da hat Raupi Recht normalerweise setzt Koda dieses Include selbst.
    Das andere musst du nur dazuschreiben wenn du Styles verwendest.