revolution Posted May 22, 2009 Share Posted May 22, 2009 Hello, sorry for my next topic here with my newbie question, but I have to write a script before this night. This is my example code MsgBox( 3, "Select", "Do you want to xyz?") And this code displays a window with three options: Yes, No and Cancel. What should I type after above code if I want, for example, button 'yes' to continue, button 'no' to display MsgBox ( MsgBox (0, "OK", "No problem") and Cancel to Sleep(2000) and then exit? Thanks Link to comment Share on other sites More sharing options...
Tinutron Posted May 22, 2009 Share Posted May 22, 2009 (edited) You just need to declare a variable. here is some code: $variable = MsgBox( 3, "Select", "Do you want to xyz?") If $variable = 6 Then Whatever() If $variable = 7 Then MsgBox( 0, "No", "No!") If $variable = 2 Then Exit Func Whatever() MsgBox( 0, "YES", "stop pressing me >_>") EndFunc EDIT: you can find a full list of what will be returned from wich button in the autoit helpfile(MsgBox) Edited May 22, 2009 by Tinutron Link to comment Share on other sites More sharing options...
Tec Posted May 22, 2009 Share Posted May 22, 2009 (edited) $Answer = MsgBox(3,"","press") Select Case $Answer = 6 ;yes MsgBox(4096,"","yes") Case $Answer = 7 ;no MsgBox(4096,"","No") Case $Answer = 2 ;Cancel MsgBox(4096,"","Cancel") EndSelect Edited May 22, 2009 by Tec Link to comment Share on other sites More sharing options...
revolution Posted May 22, 2009 Author Share Posted May 22, 2009 Thanks again Tinutron & Tec 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