Sign in to follow this  
Followers 0
sandman

How to have the script respond to a click in a messagebox.

4 posts in this topic

How can I have my script do something if the user clicks Yes or No inside the messagebox I have created?


[center]"Yes, [our app] runs on Windows as well as Linux, but if you had a Picasso painting, would you put it in the bathroom?" -BitchX.com (IRC client)"I would change the world, but they won't give me the source code." -Unknownsite . blog . portfolio . claimidcode.is.poetry();[/center]

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Button Pressed Return Value

OK 1

CANCEL 2

ABORT 3

RETRY 4

IGNORE 5

YES 6

NO 7

TRY AGAIN ** 10

CONTINUE ** 11

0 OK button 0x0

1 OK and Cancel 0x1

2 Abort, Retry, and Ignore 0x2

3 Yes, No, and Cancel 0x3

4 Yes and No 0x4

5 Retry and Cancel 0x5

6 ** Cancel, Try Again, Continue 0x6

If MsgBox(32 + 0x04, 'Knowing', 'Did you know you could do this?') = 6 Then
    MsgBox(64, 'Info', 'You pressed Yes')
Else
    MsgBox(64, 'Info', 'You pressed No')
EndIf
Edited by SmOke_N

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Weird.. I tried that and it didn't work. Let me try it again.


[center]"Yes, [our app] runs on Windows as well as Linux, but if you had a Picasso painting, would you put it in the bathroom?" -BitchX.com (IRC client)"I would change the world, but they won't give me the source code." -Unknownsite . blog . portfolio . claimidcode.is.poetry();[/center]

Share this post


Link to post
Share on other sites

look at the information in the helpfile. It is pretty strait forward on how to do it.

From the helpfile:

MsgBox

--------------------------------------------------------------------------------

Displays a simple message box with optional timeout.

MsgBox ( flag, "title", "text" [, timeout])

Parameters

flag The flag indicates the type of message box and the possible button combinations. See remarks.

title The title of the message box.

text The text of the message box.

timeout [optional] Timeout in seconds. After the timeout has elapsed the message box will be automatically closed.

Return Value

Success: Returns the ID of the button pressed.

Failure: Returns -1 if the message box timed out.

Button Pressed Return Value

OK 1

CANCEL 2

ABORT 3

RETRY 4

IGNORE 5

YES 6

NO 7

TRY AGAIN ** 10

CONTINUE ** 11

Remarks

The flag parameter can be a combination of the following values:

decimal flag Button-related Result hexadecimal flag

0 OK button 0x0

1 OK and Cancel 0x1

2 Abort, Retry, and Ignore 0x2

3 Yes, No, and Cancel 0x3

4 Yes and No 0x4

5 Retry and Cancel 0x5

6 ** Cancel, Try Again, Continue 0x6

decimal flag Icon-related Result hexadecimal flag

0 (No icon) 0x0

16 Stop-sign icon 0x10

32 Question-mark icon 0x20

48 Exclamation-point icon 0x30

64 Information-sign icon consisting of an 'i' in a circle 0x40

decimal flag Default-related Result hexadecimal flag

0 First button is default button 0x0

256 Second button is default button 0x100

512 Third button is default button 0x200

decimal flag Modality-related Result hexadecimal flag

0 Application 0x0

4096 System modal (dialog has an icon) 0x1000

8192 Task modal 0x2000

decimal flag Miscellaneous-related Result hexadecimal flag

0 (nothing else special) 0x0

262144 MsgBox has top-most attribute set 0x40000

524288 title and text are right-justified 0x80000

** Only valid on Windows 2000/XP and above.

For example, to specify a SYSTEMMODAL box with the YES/NO buttons the flag value would be 4096+4 (or 4100) If using hexadecimal flags, that would be 0x1000+0x4 (or 0x1004).

A message box appears centered on screen and resizes according to the text it contains. However, the title could get truncated if the SYSTEMMODAL flag (4096) is used.

Related

InputBox, ToolTip, TrayTip, SplashTextOn

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