ken82m 3 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 My Contributions _StringMultiReplace PC Builders Console - Secure PDF Creator - Cisco VPN Installer MS DNS Server Backup Script - MS DHCP Backup Script IT Admin Console - Toggle Admin Mode - MyMovies-Add Discs Script - IT Help Desk and System Information Tool - Set On Lid Close Power Option - Streaming Media Server & Website "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." Share this post Link to post Share on other sites
Jos 2,214 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. Share this post Link to post Share on other sites
ken82m 3 Posted January 5, 2004 damn it I'm sure i had tried that.....guess not lol well thanks alot My Contributions _StringMultiReplace PC Builders Console - Secure PDF Creator - Cisco VPN Installer MS DNS Server Backup Script - MS DHCP Backup Script IT Admin Console - Toggle Admin Mode - MyMovies-Add Discs Script - IT Help Desk and System Information Tool - Set On Lid Close Power Option - Streaming Media Server & Website "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." Share this post Link to post Share on other sites
ken82m 3 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 My Contributions _StringMultiReplace PC Builders Console - Secure PDF Creator - Cisco VPN Installer MS DNS Server Backup Script - MS DHCP Backup Script IT Admin Console - Toggle Admin Mode - MyMovies-Add Discs Script - IT Help Desk and System Information Tool - Set On Lid Close Power Option - Streaming Media Server & Website "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." Share this post Link to post Share on other sites
Jos 2,214 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. Share this post Link to post Share on other sites
Valik 478 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 Share this post Link to post Share on other sites