Yar Posted January 18, 2008 Share Posted January 18, 2008 On the Function InputBox page from the documentation, it says that if the Cancel button is pushed, the value returned will be 1. Can someone verify that this works? Because I have in my code that if the Cancel button is pushed (and 1 is returned as $input), then the program will exit.CODE$input = InputBox ("Helper", "What would you like to know?", "" , "" , 200, 30, 0, 0)If $input = 1 ThenExitElseIf $input = "" Then$box = MsgBox (0, "Helper", "Please give an answer")If $box = 1 Then$input = InputBox ("Helper", "What would you like to know?", "" , "" , 200, 30, 0, 0)EndIfEndIf Link to comment Share on other sites More sharing options...
Developers Jos Posted January 18, 2008 Developers Share Posted January 18, 2008 Pretty sure it states @error = 1 on Cancel SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
erezlevi Posted January 18, 2008 Share Posted January 18, 2008 On the Function InputBox page from the documentation, it says that if the Cancel button is pushed, the value returned will be 1. Can someone verify that this works? Because I have in my code that if the Cancel button is pushed (and 1 is returned as $input), then the program will exit. CODE$input = InputBox ("Helper", "What would you like to know?", "" , "" , 200, 30, 0, 0) If $input = 1 Then ExitElseIf $input = "" Then $box = MsgBox (0, "Helper", "Please give an answer") If $box = 1 Then $input = InputBox ("Helper", "What would you like to know?", "" , "" , 200, 30, 0, 0)EndIfEndIf it is the @error that returns the "1" you should write it : expandcollapse popup if @error=1 then... Link to comment Share on other sites More sharing options... Yar Posted January 18, 2008 Yar Members 12 Author Share Posted January 18, 2008 Ahh, I misunderstood it then. Thank you very much. Link to comment Share on other sites More sharing options... GEOSoft Posted January 18, 2008 GEOSoft MVPs 10.3k Sure I'm senile. What's your excuse? Share Posted January 18, 2008 On the Function InputBox page from the documentation, it says that if the Cancel button is pushed, the value returned will be 1. Can someone verify that this works? Because I have in my code that if the Cancel button is pushed (and 1 is returned as $input), then the program will exit. CODE$input = InputBox ("Helper", "What would you like to know?", "" , "" , 200, 30, 0, 0) If $input = 1 Then ExitElseIf $input = "" Then $box = MsgBox (0, "Helper", "Please give an answer") If $box = 1 Then $input = InputBox ("Helper", "What would you like to know?", "" , "" , 200, 30, 0, 0)EndIfEndIfThat's not what the help file says. What is does say is that @Error will be set to 1. Replace your code with While NOT @Error $input = InputBox ("Helper", "What would you like to know?", "" , "" , 200, 30, 0, 0) If @Error = 1 Then Exit If $input = "" Then $box = MsgBox (0, "Helper", "Please give an answer") ContinueLoop Else ExitLoop EndIf Wend George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" 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