Wie mach ich dass wenn ich retry drück das gleiche nochmal kommt?

  • vllcht ein KL. skript Beispiel? zb ich hab pw generatir und da steht jetzt die zahl,unten bei den button steht Abbrechen oder Retry ,wie kann ich machen dass wen ich retry drück nochmal eine zahl generiert wird ?

  • [autoit]

    #include <ButtonConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>
    $Form1 = GUICreate("Form1", 120, 86, 254, 124)
    $Label1 = GUICtrlCreateLabel("", 8, 8, 36, 17)
    $Button1 = GUICtrlCreateButton("Button1", 8, 40, 75, 25, $WS_GROUP)
    GUISetState(@SW_SHOW)

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

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

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

    Func _generate()
    GUICtrlSetData($Label1, Random(1, 1000, 1))
    EndFunc

    [/autoit]
  • [autoit]


    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <ButtonConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>
    $gui = GUICreate("Passwort Creator", 600, 250, 300, 25)
    $Label1 = GUICtrlCreateLabel("", 8, 8, 36, 17)
    $1 = GUICtrlCreateButton("3 Stelliges Kennwort", 8, 8, 120, 25, $WS_GROUP)
    $2 = GUICtrlCreateButton("4 Stelliges Kennwort", 140, 8, 120, 25, $WS_GROUP)
    $3 = GUICtrlCreateButton("5 Stelliges Kennwort", 268, 8, 120, 25, $WS_GROUP)
    $4 = GUICtrlCreateButton("6 Stelliges Kennwort", 400, 8, 120, 25, $WS_GROUP)
    $5 = GUICtrlCreateButton("Zufällige Zahl generieren",8, 50, 200, 25, $WS_GROUP)
    $6 = GUICtrlCreateButton("Züfälliges Datum generieren", 250, 50, 200, 25, $WS_GROUP)
    GUISetState(@SW_SHOW)

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

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

    Case $1
    MsgBox(5,"Zahl","Dein Kennwort lautet: " & Random( 100, 999, 1))
    Case $2
    MsgBox(5,"Zahl","Dein Kennwort lautet: " & Random( 1000, 9999, 1))
    Case $3
    MsgBox(5,"Zahl","Dein Kennwort lautet: " & Random( 10000, 99999, 1))
    Case $4
    MsgBox(5,"Zahl","Dein Kennwort lautet: " & Random( 100000, 999999, 1))
    Case $5
    MsgBox(5,"Dein Passwort","Deine Zufällige Zahl: " & Random(0,999999,1))
    Case $6
    MsgBox("5","Dein Datum","Dein Zufälliges Datum: " & Random (1,30,1)& Random(0,0,1)& Random (1,9,1)& Random (2010,2011,1))
    EndSwitch
    WEnd

    [/autoit]

    ich möchte wenn man widerholen klcikt das er noch mal generiert,wenn man abbrechen klickt soll er das fenster schliesen

  • Schau in der Hilfe nach.

    Zitat

    [Heute, 11:39] Raupi: Soll ich es dir machen?
    [Heute, 11:47] BugFix: "Soll ich es dir machen? " - also Raupi !! bitte nicht so öffentlich :rofl:

    Zitat

    [Heute, 11:51] BugFix: und ich werde es mir jetzt machen - das Mittagessen :P

    AMsg UDF v1.00.00 IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII 100%
    OwnStyle UDF Version 1.10.00 IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII 100%

  • Warum so umständlich? Warum erstellst du nicht einfach ein Label in deiner GUI? Anstatt dann beim Button Event die MsgBox zu öffnen setzt du einfach mit GUICtrlSetData() den Inhalt des Labels neu.

    Das ewige neu aufpoppen der Boxen ist doch eher anwenderunfreundlich.

  • Hier: >,<

    Spoiler anzeigen
    [autoit]

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

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

    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("Passwort Creator", 308, 175, 154, 124)
    $Label1 = GUICtrlCreateLabel("Ergebnis:", 40, 16, 48, 17)
    $1 = GUICtrlCreateButton("3 Stelliges Kennwort", 32, 40, 115, 25, 0)
    $2 = GUICtrlCreateButton("4 Stelliges Kennwort", 160, 40, 115, 25, 0)
    $3 = GUICtrlCreateButton("5 Stelliges Kennwort", 32, 80, 115, 25, 0)
    $4 = GUICtrlCreateButton("6 Stelliges Kennwort", 160, 80, 115, 25, 0)
    $5 = GUICtrlCreateButton("Zufallszahl", 32, 120, 115, 25, 0)
    $6 = GUICtrlCreateButton("Zufallsdatum", 168, 120, 115, 25, 0)
    $Input1 = GUICtrlCreateInput("", 96, 8, 193, 21)
    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

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

    Case $1
    ;MsgBox(5,"Zahl","Dein Kennwort lautet: " & Random( 100, 999, 1))
    GUICtrlSetData( $Input1 , Random(100,999,1))
    Case $2
    ;MsgBox(5,"Zahl","Dein Kennwort lautet: " & Random( 1000, 9999, 1))
    GUICtrlSetData( $Input1 , Random(1000,9999,1))
    Case $3
    ;MsgBox(5,"Zahl","Dein Kennwort lautet: " & Random( 10000, 99999, 1))
    GUICtrlSetData( $Input1 , Random(10000,99999,1))
    Case $4
    ;MsgBox(5,"Zahl","Dein Kennwort lautet: " & Random( 100000, 999999, 1))
    GUICtrlSetData( $Input1 , Random(100000,999999,1))
    Case $5
    ;MsgBox(5,"Dein Passwort","Deine Zufällige Zahl: " & Random(0,999999,1))
    GUICtrlSetData( $Input1 , Random(0,999999,1))
    Case $6
    ;MsgBox("5","Dein Datum","Dein Zufälliges Datum: " & Random (1,30,1)& Random(0,0,1)& Random (1,9,1)& Random (2010,2011,1))
    GUICtrlSetData( $Input1 , Random (1,30,1)&"."& Random(0,0,1)&"."& Random (1,9,1)&"."& Random (2010,2011,1))
    EndSwitch
    WEnd

    [/autoit]

    (GUI abgeändert)

  • Um auf den Thread (und die Frage im Startpost) zurückzukommen:

    Spoiler anzeigen
    [autoit]

    $hGUI = GUICreate("")
    $hButton = GUICtrlCreateButton("Drück mich",20,20)
    GUISetState()

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case -3
    Exit
    Case $hButton

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

    Do
    $New_Passwort = Random(1,1000)
    Until MsgBox(5,"","Nochmal? "&$New_Passwort) <> 4

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

    MsgBox(0,"","Du hast " &$New_Passwort & " gewählt")

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

    EndSwitch
    WEnd

    [/autoit]
  • Hatte nen bisschen Langeweile :P

    Spoiler anzeigen
    [autoit]

    #include <ButtonConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <GUIListBox.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>
    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("Form1", 328, 115, 192, 124)
    $Button1 = GUICtrlCreateButton("Passwort generieren", 200, 40, 123, 25, $WS_GROUP)
    $Button2 = GUICtrlCreateButton("Kopieren", 200, 80, 123, 25, $WS_GROUP)
    $Label1 = GUICtrlCreateLabel("", 8, 8, 100, 17)
    $Combo1 = GUICtrlCreateCombo("Länge", 200, 8, 121, 25)
    GUICtrlSetData(-1, "4|5|6|7|8")
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

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

    Dim $passwd

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Button1
    If GUICtrlRead($Combo1) = "Länge" Then
    TrayTip('Error','Es muss zunächst die stärke des Passwortes festgelegt werden',20,3)
    Else
    $passwd = ""
    GUICtrlSetData($Label1,"")
    For $i = 1 to GUICtrlRead($Combo1)
    $random = Random(1,3,1)
    If $random = 1 Then
    $addchar = Chr(Random(48,57,1))
    ElseIf $random = 2 Then
    $addchar = Chr(Random(65,90,1))
    Else
    $addchar = Chr(Random(97,122,1))
    EndIf
    $passwd &= $addchar
    Next
    GUICtrlSetData($Label1,$passwd)
    TrayTip('Info','Passwort ist erfolgreich generiert worden',20,1)
    EndIf
    Case $Button2
    If GUICtrlRead($Label1) = '' Then
    TrayTip('Achtung','Es sollte zunächst ein Passwort generiert werden',20,2)
    Else
    ClipPut(GUICtrlRead($Label1))
    TrayTip('Info','Passwort in die Zwischenablage kopiert',20,1)
    EndIf
    EndSwitch
    WEnd

    [/autoit]

    21 is only half the truth.

  • Ist es möglich eine While Schleife in eine andere zu verschachteln ? Wird diese dann mit "While 2" deklariert ?

  • Klar ist das möglich. Bei jeder kommt eine 1 rein. Da 1 ja immer wahr ist ;). Dann ist es nämlich eine Endlosschleife.

  • Aber irgentwas mache ich falsch hier.:

    Spoiler anzeigen

    $passwd1 = 0
    While 1
    If not _Crypt_HashData($passwd1, $CALG_MD5)= $h4sh1 Then
    $passwd1 = InputBox("Passwortabfrage", "Bitte Passwort eingeben", "", "*")
    Else
    ExitLoop
    EndIf
    WEnd

  • Wohl eher so:

    [autoit]

    While 1
    $passwd1 = InputBox("Passwortabfrage", "Bitte Passwort eingeben", "", "*")
    If _Crypt_HashData($passwd1, $CALG_MD5)= $h4sh1 Then ExitLoop
    WEnd

    [/autoit]