ken82m Posted January 5, 2004 Share Posted January 5, 2004 (edited) I'm trying to capture what button is pressed on a MSGBOx or Input Box. Why won't this script exit upon hitting cancel like i told it to on the line 8? If $Ddrive == "Fixed" AND $DPROE2001 = 1 AND $CPROE2001 = 1 Then Do PromptForDrive() ;(the above line calls a function that will prompt them to enter C: or D:) If $destination <> "C:" Or $destination <> "D:" Then $error = MsgBox(4096+5,"Invalid Drive Specified","The Entry Specified was invalid. Please Try Again.") If @error = 2 Then Exit EndIf Until $destination == "C:" Or $destination == "D:" EndIf Exit Func PromptForDrive( ) $destination = InputBox("Select Destination Drive", "Please Enter C: or D: for the destination drive", "C:", "") EndFunc Thanks, Kenny Edited January 5, 2004 by ken82m "I believe that when we leave a place, part of it goes with us and part of us remains... Go anywhere, when it is quiet, and just listen.. After a while, you will hear the echoes of all our conversations, every thought and word we've exchanged.... Long after we are gone our voices will linger in these walls for as long as this place remains." Link to comment Share on other sites More sharing options...
Developers Jos Posted January 5, 2004 Developers Share Posted January 5, 2004 This should work...$rc = MsgBox(4096+5,"Invalid Drive Specified","The Entry Specified was invalid. Please Try Again.")If $rc = 2 Then Exit SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
ken82m Posted January 5, 2004 Author Share Posted January 5, 2004 damn it I'm sure i had tried that.....guess not lol well thanks alot "I believe that when we leave a place, part of it goes with us and part of us remains... Go anywhere, when it is quiet, and just listen.. After a while, you will hear the echoes of all our conversations, every thought and word we've exchanged.... Long after we are gone our voices will linger in these walls for as long as this place remains." Link to comment Share on other sites More sharing options...
ken82m Posted January 5, 2004 Author Share Posted January 5, 2004 (edited) One more thing, you'll see this in the code I pasted above: If $destination <> "C:" Or $destination <> "D:" Then MsgBox(4096,"Invalid Drive Specified","The Entry Specified was invalid. Please Try Again.") EndIf I get the message box even when $destination DOES equal C: or D: but I know the C: or D: is in their because as soon I hit OK the script continues because the UNTIL variable was met which just says keep going until $destination = C: or D:. Did I miss a pace or something? Thanks again, Kenny Edited January 5, 2004 by ken82m "I believe that when we leave a place, part of it goes with us and part of us remains... Go anywhere, when it is quiet, and just listen.. After a while, you will hear the echoes of all our conversations, every thought and word we've exchanged.... Long after we are gone our voices will linger in these walls for as long as this place remains." Link to comment Share on other sites More sharing options...
Developers Jos Posted January 5, 2004 Developers Share Posted January 5, 2004 (edited) You need to add $destination="" or Global $destinationto te top of the script.Its now a LOCAL variable for the Func PromptForDrive( ) only.And the OR needs to be and AND Alternative would be:If $Ddrive == "Fixed" AND $DPROE2001 = 1 AND $CPROE2001 = 1 Then Do $destination=PromptForDrive() ;(the above line calls a function that will prompt them to enter C: or D:) If $destination <> "C:" And $destination <> "D:" Then $error = MsgBox(4096+5,"Invalid Drive Specified","The Entry Specified was invalid. Please Try Again.") If @error = 2 Then Exit EndIf Until $destination == "C:" Or $destination == "D:"EndIfExitFunc PromptForDrive( ) Return InputBox("Select Destination Drive", "Please Enter C: or D: for the destination drive", "C:", "")EndFuncJos Edited January 5, 2004 by JdeB SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Valik Posted January 5, 2004 Share Posted January 5, 2004 It's the way you set the IF statement up. If it finds D, the first condition is true, if it's C, the second conditions is true. If it's any other drive letter, both conditions will be true. It's impossible to NOT get a true result with that construct. Try to restructure it so that: IF $drive = "C:" OR $drive = "D:" THEN ; Do stuff when the drive is found ELSE ; Do stuff when the drive is NOT found ENDIF Link to comment Share on other sites More sharing options...
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