PantZ4 Posted October 6, 2006 Posted October 6, 2006 Dim $password[10] $password[1] = "1" $password[2] = "2" $passwordwindow = GUICreate("",180,100) GUICtrlCreateGroup("Password", 10, 10, 160, 55) $passwordtext = GUICtrlCreateInput("",20,30,140,20,$es_password) $passwordenter = GUICtrlCreateButton("Ok",10,70,75,20,$BS_DEFPUSHBUTTON) $passwordexit = GUICtrlCreateButton("Cancel",95,70,75,20) GuiSetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Or $msg = $passwordexit GUIDelete() Exit Case $msg = $passwordenter If GUICtrlRead($passwordtext) = $password[Number] Then Exitloop Else MsgBox(8240,"Wrong password","Wrong password. Please try again...",0) EndIf EndSelect WEndoÝ÷ ÙhZ¶l©®åzh¬-¢Æ²jëh×6If GUICtrlRead($passwordtext) = $password[A number] I have tryed with for $i 1 to 10 step 1, but I couldn't get it to work . A loop, it was that it was called . Thank You
PsaltyDS Posted October 6, 2006 Posted October 6, 2006 Dim $password[10] $password[1] = "1" $password[2] = "2" $passwordwindow = GUICreate("",180,100) GUICtrlCreateGroup("Password", 10, 10, 160, 55) $passwordtext = GUICtrlCreateInput("",20,30,140,20,$es_password) $passwordenter = GUICtrlCreateButton("Ok",10,70,75,20,$BS_DEFPUSHBUTTON) $passwordexit = GUICtrlCreateButton("Cancel",95,70,75,20) GuiSetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Or $msg = $passwordexit GUIDelete() Exit Case $msg = $passwordenter If GUICtrlRead($passwordtext) = $password[Number] Then Exitloop Else MsgBox(8240,"Wrong password","Wrong password. Please try again...",0) EndIf EndSelect WEndoÝ÷ ÙhZ¶l©®åzh¬-¢Æ²jëh×6If GUICtrlRead($passwordtext) = $password[A number]oÝ÷ ØZ½ëkÉçpØ_¢½7ê-m£],µêunëHr¥v}ý¶ÛhÂäè@)ܲØZ¶+pjÇW¬¶W©äb¿ªê-xX«²ÐâMú¥«,ÂÝ×G^rV«zƧuªëk,"¶¥zg§¶Çë¢m7ꬳ +wKa®í7ꬳ +wÔrݶ¬y§è®Z(¥«¢+Ù½ÈÀÌØí¤ôÀQ¼ä(%U% ÑɱI ÀÌØíÁÍÍݽÉÑáФôÀÌØíÁÍÍݽÉlÀÌØí¥tQ¡¸(ìe½ÕȽ¹¥Ñ¥½¹°½¡É(¹%)9áÐ Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Valuater Posted October 6, 2006 Posted October 6, 2006 Maybe... #include <GUIConstants.au3> Dim $passwords = StringSplit("dave,john,sue,anyone", ",") Dim $passok = 0 $passwordwindow = GUICreate("", 180, 100) GUICtrlCreateGroup("Password", 10, 10, 160, 55) $passwordtext = GUICtrlCreateInput("", 20, 30, 140, 20, $es_password) $passwordenter = GUICtrlCreateButton("Ok", 10, 70, 75, 20, $BS_DEFPUSHBUTTON) $passwordexit = GUICtrlCreateButton("Cancel", 95, 70, 75, 20) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Or $msg = $passwordexit GUIDelete() Exit Case $msg = $passwordenter $passcheck = GUICtrlRead($passwordtext) For $x = 1 To $passwords[0] If $passcheck = $passwords[$x] Then $passok = 1 Next If $passok Then ExitLoop MsgBox(8240, "Wrong password", "Wrong password. Please try again...", 0) EndSelect WEnd 8)
PantZ4 Posted October 6, 2006 Author Posted October 6, 2006 First, Dim $password[10] declares and array with elements from $password[0] thru $password[9]. Second, to use a for loop: For $i = 0 To 9 If GUICtrlRead($passwordtext) = $password[$i] Then ; Your conditional code here EndIf Next Thank you
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now