Jump to content

If "ok" then do this


filip
 Share

Recommended Posts

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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]
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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]
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...