Jump to content
Sign in to follow this  
filip

If "ok" then do this

Recommended Posts

filip

Hello, i've got a small problem, i just started with AutoIt and I need help. Basicly what i need is a meassage window to pop up and if i click Ok on it then i whant the script to continue. If i click Cancel on I whant the scritp to close. Basicly the recognition of the buttons on the msgbox, If and Then.

Share this post


Link to post
Share on other sites
GEOSoft

;
$MsgBox = MsgBox(262177, "TEST", "Would you like to continue")
If $MsgBox = 2 Then Exit
; Rest of the code here
;


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!"

Share this post


Link to post
Share on other sites
filip

Yes that is great, thank you. I tried to do it myself earlier, all I was missing was $MsgBox. What actually $MsgBox does?

Share this post


Link to post
Share on other sites
GEOSoft

Yes that is great, thank you. I tried to do it myself earlier, all I was missing was $MsgBox. What actually $MsgBox does?

It just creates a variable where we can check the action performed. See Help File >> Functions >> Message Boxes and Dialogs >> MsgBox and look at the Return Values table.

You can do the same thing wit

;
If MsgBox(262177, "TEST", "Would you like to continue") = 2 Then Exit
;
Edited by GEOSoft

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!"

Share this post


Link to post
Share on other sites
colafrysen

I like to Switch MsgBoxes >_<

Switch MsgBox(0, "Title", "Body")
    Case 1 ;Someone clicked OK
    Case 2 ;Someone clicked Cancel
    Case 3 ;Someone clicked Abort
    Case 4 ;Someone clicked Retry
    Case 5 ;Someone clicked Ignore
    Case 6 ;Someone clicked Yes
    Case 7 ;Someone clicked No
    Case 10 ;Someone Wants to try again
    Case 11 ;Someone clicked Continue
    Case - 1 ;Someone was to slow
EndSwitch

[font="Impact"]Use the helpfile, It´s one of the best exlusive features of Autoit.[/font]http://support.microsoft.com/kb/q555375ALIBI Run - a replacement for the windows run promptPC Controller - an application for controlling other PCs[size="1"]Science flies us to the moon. Religion flies us into buildings.[/size][size="1"]http://bit.ly/cAMPZV[/size]

Share this post


Link to post
Share on other sites
GEOSoft

I like to Switch MsgBoxes >_<

Switch MsgBox(0, "Title", "Body")
    Case 1 ;Someone clicked OK
    Case 2 ;Someone clicked Cancel
    Case 3 ;Someone clicked Abort
    Case 4 ;Someone clicked Retry
    Case 5 ;Someone clicked Ignore
    Case 6 ;Someone clicked Yes
    Case 7 ;Someone clicked No
    Case 10 ;Someone Wants to try again
    Case 11 ;Someone clicked Continue
    Case - 1 ;Someone was to slow
EndSwitch

Hardly worth the effort when he only needed to check one button and exit the script if it was clicked.

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!"

Share this post


Link to post
Share on other sites
colafrysen

Very true, but with three button msgboxes it can be quite handy :( (or if your lazy and love copy and paste >_< )


[font="Impact"]Use the helpfile, It´s one of the best exlusive features of Autoit.[/font]http://support.microsoft.com/kb/q555375ALIBI Run - a replacement for the windows run promptPC Controller - an application for controlling other PCs[size="1"]Science flies us to the moon. Religion flies us into buildings.[/size][size="1"]http://bit.ly/cAMPZV[/size]

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.