Sign in to follow this  
Followers 0
revolution

MsgBox

4 posts in this topic

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

Share this post


Link to post
Share on other sites



#2 ·  Posted (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 by Tinutron

Share this post


Link to post
Share on other sites

#3 ·  Posted (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 by Tec

Share this post


Link to post
Share on other sites

Thanks again Tinutron & Tec :)

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0