IvanCodin Posted December 25, 2007 Share Posted December 25, 2007 How do I define what happens what the cancel button is pressed? I want to give an option to press cancel and then exit the script if cancel is pressed. <-- script --> $UserInput = "test" Do $answer = InputBox("Info is Required", "Please Input Your Access code.", "", "*") If $answer == $UserInput Then ; move on Else MsgBox(0,"Invalid", "Please enter the access code. Try Again.") EndIf Until $answer == $UserInput <-- /script --> The help file indicates a return @Error of 1 is returned from the cancel button. How do you set what is done when the error return value is sent? CC Link to comment Share on other sites More sharing options...
The Ape Posted December 25, 2007 Share Posted December 25, 2007 (edited) $UserInput = "test" Do $answer = InputBox("Info is Required", "Please Input Your Access code.", "", "*") If $answer == $UserInput Then ; move on ElseIf @error = 1 Then Exit Else MsgBox(0, "Invalid", "Please enter the access code. Try Again.") EndIf Until $answer == $UserInput Edited December 25, 2007 by The Ape FixJaw.comTriad-Art.com Link to comment Share on other sites More sharing options...
star2 Posted December 25, 2007 Share Posted December 25, 2007 (edited) $UserInput = "test" Do $answer = InputBox("Info is Required", "Please Input Your Access code.", "", "*") If @error = 1 Then MsgBox (-1,"test" , "you pressed Cancel") ElseIf $answer = $UserInput Then MsgBox (-1,"test","you typed test" & @crlf & "now Exiting") ElseIf $answer <> $UserInput Then MsgBox (-1, "test", "you have entered the wrong password") EndIf Until $answer = $UserInput I'm not sure what u want !!! Edited December 25, 2007 by star2 [quote]Baby you're all that I want, When you're lyin' here in my armsI'm findin' it hard to believe, We're in heavenAnd love is all that I need , And I found it there in your heartIt isn't too hard to see, We're in heaven .Bryan Adams[/quote].............................................................................[u]AUTOIT[/u] Link to comment Share on other sites More sharing options...
IvanCodin Posted December 25, 2007 Author Share Posted December 25, 2007 Thanks for the assist!!! Thats exactly what I was tring to do. Ask for an entry and give the user an option to press cancel to exit is desired. Me 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