Ultima2 Posted November 25, 2008 Share Posted November 25, 2008 I've been trying to write a script for checking password. I've got it this far. #include <GUIConstants.au3> $pass = InputBox("Password", "Password", "", "*") While 1 If $pass <> "my-pass" Then $WrongPass = MsgBox(1, "Wrong Pass", "Retry?") If $WrongPass = 1 Then $pass = InputBox("Password", "Password", "", "*") EndIf If $WrongPass = 2 Then ExitLoop EndIf EndIf WEnd MsgBox(0,"Good Job", "Good Job") The problem I've been having is that when the wrong password is put in, the script kept continuing to the MsgBox part. Is there a way to write it such that if a wrong password is entered, the script will stop and not continue to the other part? Link to comment Share on other sites More sharing options...
November Posted November 25, 2008 Share Posted November 25, 2008 (edited) Hi there m8, Try this code: #include <GUIConstants.au3> Do $pass = InputBox("Password", "Password", "", "*") If @error = 1 Then Exit EndIf Until $pass = "my-pass" MsgBox(0,"Good Job", "Good Job") Cheers Edited November 25, 2008 by November Old Scriptology Visual Ping 1.8 - Mass Ping Program with export to txt delimited. Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code. Desktop 2 RGB - Pick a color in the desktop and get the RGB code. ShootIT 1.0 - Screen Capture full and partial screen [font="'Arial Black';"]Remember Remember The Fifth of November.[/font] Link to comment Share on other sites More sharing options...
Ultima2 Posted November 25, 2008 Author Share Posted November 25, 2008 Hi there m8, Try this code: Do $pass = InputBox("Password", "Password", "", "*") Until $pass = "my-pass" MsgBox(0,"Good Job", "Good Job") CheersThanks a lot, but if someone click close or cancel on the inputbox it will just keep looping. Is there a way to make it so that it wont loop, but if a wrong password is entered the script will end right there and not continue? Link to comment Share on other sites More sharing options...
November Posted November 25, 2008 Share Posted November 25, 2008 Thanks a lot, but if someone click close or cancel on the inputbox it will just keep looping. Is there a way to make it so that it wont loop, but if a wrong password is entered the script will end right there and not continue?Yeah... i updated the code Check it now Cheers Old Scriptology Visual Ping 1.8 - Mass Ping Program with export to txt delimited. Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code. Desktop 2 RGB - Pick a color in the desktop and get the RGB code. ShootIT 1.0 - Screen Capture full and partial screen [font="'Arial Black';"]Remember Remember The Fifth of November.[/font] Link to comment Share on other sites More sharing options...
Ultima2 Posted November 25, 2008 Author Share Posted November 25, 2008 Yeah... i updated the code Check it now CheersOh cool now it works, thanks man Link to comment Share on other sites More sharing options...
TehWhale Posted November 25, 2008 Share Posted November 25, 2008 (edited) Do $pass = InputBox("Password", "Password", "", "*") If @error Then Exit Until $pass = "password" Ah, I'm a little late. Edited November 25, 2008 by TehWhale Link to comment Share on other sites More sharing options...
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