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 ?
Wie mach ich dass wenn ich retry drück das gleiche nochmal kommt?
-
- [ offen ]
-
firstclass96 -
24. April 2010 um 18:10 -
Geschlossen -
Erledigt
-
-
du brauchst eine while schleife und wenn das geschehen ist, was nicht sollte, dann fängt es von vorne an, wenn das geschehen ist, was sollte, dann machst di exitloop
[autoit]While 1
[/autoit]
If Not ; ...
; ...
Else
ExitLoop
EndIf
WEnd -
[autoit]
#include <ButtonConstants.au3>
[/autoit][autoit][/autoit][autoit]
#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)While 1
[/autoit][autoit][/autoit][autoit]
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
_generate()
EndSwitch
WEndFunc _generate()
[/autoit]
GUICtrlSetData($Label1, Random(1, 1000, 1))
EndFunc -
[autoit]
[/autoit][autoit][/autoit][autoit][/autoit][autoit][/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)While 1
[/autoit]
$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
WEndich möchte wenn man widerholen klcikt das er noch mal generiert,wenn man abbrechen klickt soll er das fenster schliesen
-
[autoit]
If $answer = 4 Then ;...
[/autoit]das bild hab ich irgentwann mal gefunden
-
Schau in der Hilfe nach.
-
was muss ich nach then schreiben ?_
-
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>
[/autoit] [autoit][/autoit] [autoit]
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>#Region ### START Koda GUI section ### Form=
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
$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 ###While 1
[/autoit] [autoit][/autoit] [autoit]
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
ExitCase $1
[/autoit]
;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(GUI abgeändert)
-
Um auf den Thread (und die Frage im Startpost) zurückzukommen:
Spoiler anzeigen
[autoit]$hGUI = GUICreate("")
[/autoit] [autoit][/autoit] [autoit]
$hButton = GUICtrlCreateButton("Drück mich",20,20)
GUISetState()While 1
[/autoit] [autoit][/autoit] [autoit]
$nMsg = GUIGetMsg()
Switch $nMsg
Case -3
Exit
Case $hButtonDo
[/autoit] [autoit][/autoit] [autoit]
$New_Passwort = Random(1,1000)
Until MsgBox(5,"","Nochmal? "&$New_Passwort) <> 4MsgBox(0,"","Du hast " &$New_Passwort & " gewählt")
[/autoit] [autoit][/autoit] [autoit]EndSwitch
[/autoit]
WEnd -
Hatte nen bisschen Langeweile
Spoiler anzeigen
[autoit]#include <ButtonConstants.au3>
[/autoit] [autoit][/autoit] [autoit]
#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 ###Dim $passwd
[/autoit] [autoit][/autoit] [autoit]While 1
[/autoit]
$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 -
du brauchst eine while schleife und wenn das geschehen ist, was nicht sollte, dann fängt es von vorne an, wenn das geschehen ist, was sollte, dann machst di exitloop
[autoit]While 1
[/autoit]
If Not ; ...
; ...
Else
ExitLoop
EndIf
WEndIst 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
[/autoit]
$passwd1 = InputBox("Passwortabfrage", "Bitte Passwort eingeben", "", "*")
If _Crypt_HashData($passwd1, $CALG_MD5)= $h4sh1 Then ExitLoop
WEnd -
Ich Depp danke