SuperFlyChetGuy Posted September 11, 2007 Posted September 11, 2007 I have created a button to either press OK to continue or CANCEL to quit but pressing CANCEL doesn't quit. Yes I am a n00b to all this so did I miss some code that tells it "if cancel is pressed then end" ? If Not IsDeclared("iMsgBoxAnswer") Then Local $iMsgBoxAnswer $iMsgBoxAnswer = MsgBox(1,"","This is my message!" & @CRLF & "If you do not wish to proceed with removing these files please" & @CRLF & "press the CANCEL button now.") Select Case $iMsgBoxAnswer = 1;OK Case $iMsgBoxAnswer = 2;Cancel EndSelect The SuperFlyChetGuy
ksmith247 Posted September 11, 2007 Posted September 11, 2007 I have created a button to either press OK to continue or CANCEL to quit but pressing CANCEL doesn't quit. Yes I am a n00b to all this so did I miss some code that tells it "if cancel is pressed then end" ? If Not IsDeclared("iMsgBoxAnswer") Then Local $iMsgBoxAnswer $iMsgBoxAnswer = MsgBox(1,"","This is my message!" & @CRLF & "If you do not wish to proceed with removing these files please" & @CRLF & "press the CANCEL button now.") Select Case $iMsgBoxAnswer = 1;OK Case $iMsgBoxAnswer = 2;Cancel EndSelect You need to tell the script what to do when a particular button is clicked. If Not IsDeclared("iMsgBoxAnswer") Then Local $iMsgBoxAnswer $iMsgBoxAnswer = MsgBox(1,"","This is my message!" & @CRLF & "If you do not wish to proceed with removing these files please" & @CRLF & "press the CANCEL button now.") Select Case $iMsgBoxAnswer = 1;OK MsgBox(0, "OK", "You clicked OK") Case $iMsgBoxAnswer = 2 ;Cancel Exit EndSelect Support bacteria; it's the only culture most people have.LxP's Learning to Script with AutoIt 3 - Excellent starting placeVolly's Links Page - Links to cool and useful scriptsAutoIt Wrappers - Valuater's AutoIt Wrappers post. Lots of good stuff.Support AutoIt - Make a donation here; I did.[size="2"]#include <Guinness.pint>[/size]
ssubirias3 Posted September 11, 2007 Posted September 11, 2007 (edited) Yes you are missing the code to tell the script what to do when those conditions are true. Is there a reason why you're not looking at the example code in the Help file? Look at the example code (scroll to the bottom of the page) for Select(). Hope that makes sense .Edit: Ksmith247, you good you. Just remember there's a fine line between being a helper and an enabler of certain behaviors. Doing for someone what they are capable of doing for themselves is really a disservice. Edited September 11, 2007 by ssubirias3
SuperFlyChetGuy Posted September 11, 2007 Author Posted September 11, 2007 Awesome! Thanks a bunch. @ssubirias3 - I looked but maybe I was looking at the wrong help files as I do not recall seeing that clarified. I thank you for you input. The SuperFlyChetGuy
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