BattleOfMoonShae Posted January 22, 2005 Share Posted January 22, 2005 Could someone tell me how I did the msgbox wrong? When the cancel button is selected the script fails to exit and close out. ($__msgbox = 2) AutoItSetOption("WinTitleMatchMode", 4) AutoItSetOption("SendKeyDelay", 1) AutoItSetOption("WinWaitDelay", 100) HotKeySet("{ESC}", "Terminate") ; press pause key to exit script ProgressOn("Progress Meter", "Increments every percent", "0 percent", 600, 860) For $i = 10 To 100 Step 10 Sleep(50) ProgressSet($i, $i & " percent") WinWait('File List - Microsoft Internet Explorer') If Not WinActive('File List - Microsoft Internet Explorer', '') Then WinActivate('File List - Microsoft Internet Explorer') EndIf WinWaitActive('File List - Microsoft Internet Explorer') $Filename = InputBox("Question", "What is the file name you seek?", "Aircraft Name", "", _ -1, -1, 0, 0) WinWait('Quattro Pro 12') If Not WinActive('Quattro Pro 12', '') Then WinActivate('Quattro Pro 12') EndIf WinWaitActive('Quattro Pro 12') Send('{ALTDOWN}e{ALTUP}') Sleep(1) Send('f') Sleep(1) Send($Filename) Sleep(1) Do; Retry Send('{ALTDOWN}n{ALTUP}') Sleep(1) $__msgbox = MsgBox(3, 'FILE SELECTION', 'IS THIS THE FILE NAME YOU REQUIRE?') Until NOT ($__msgbox = 7) If NOT ($__msgbox = 2) Then If NOT ($__msgbox = 6) Then EndIf;; Close Exit EndIf;;;; Success Send('{ALTDOWN}c{ALTUP}') Sleep(1) Send('{ALTDOWN}e{ALTUP}') Sleep(1) Send('c') WinWait('File List - Microsoft Internet Explorer') If Not WinActive('File List - Microsoft Internet Explorer', '') Then WinActivate('File List - Microsoft Internet Explorer') EndIf WinWaitActive('File List - Microsoft Internet Explorer') Send('{ENTER}') WinWait('Copyright Notice - Microsoft Internet Explorer') If Not WinActive('Copyright Notice - Microsoft Internet Explorer', '') Then WinActivate('Copyright Notice - Microsoft Internet Explorer') EndIf WinWaitActive('Copyright Notice - Microsoft Internet Explorer') Send('{SHIFTDOWN}{TAB}{TAB}{TAB}{SHIFTUP}') Sleep(1) Send('{ENTER}') WinWait('Add new download') If Not WinActive('Add new download', '') Then WinActivate('Add new download') EndIf WinWaitActive('Add new download') Send('{TAB}{TAB}{TAB}{TAB}{TAB}') Sleep(1) Send('{CTRLDOWN}v{CTRLUP}') Sleep(1) Send('{ENTER}') WinWait('Copyright Notice - Microsoft Internet Explorer') If Not WinActive('Copyright Notice - Microsoft Internet Explorer', '') Then WinActivate('Copyright Notice - Microsoft Internet Explorer') EndIf WinWaitActive('Copyright Notice - Microsoft Internet Explorer') Send('{ALTDOWN}v{ALTUP}') Sleep(1) Send('o') Sleep(1) Send('b') WinWait('File List - Microsoft Internet Explorer') If Not WinActive('File List - Microsoft Internet Explorer', '') Then WinActivate('File List - Microsoft Internet Explorer') EndIf WinWaitActive('File List - Microsoft Internet Explorer') Send('{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}') Send("{SHIFTDOWN}{TAB}{TAB}{TAB}{SHIFTUP}") ;EndIf;; Close ;Exit Next ProgressSet(100, "Done", "Complete") Sleep(50) ProgressOff() Exit Func Terminate() Exit 0 EndFunc ;==>Terminate Link to comment Share on other sites More sharing options...
MHz Posted January 22, 2005 Share Posted January 22, 2005 (edited) If NOT ($__msgbox = 2) Then <---- If NOT ($__msgbox = 6) Then EndIf;; Close Exit <---- EndIf;;;; Success If Not $__msgbox = 2 then Exit. So Cancel means do NOT Exit. Edit:Typo Edited January 22, 2005 by MHz Link to comment Share on other sites More sharing options...
phillip123adams Posted January 22, 2005 Share Posted January 22, 2005 Could someone tell me how I did the msgbox wrong? When the cancel button is selected the script fails to exit and close out. ($__msgbox = 2)When cancel is clicked, $Filename is assigned a null string, and the WinWait on the next line simply waits for the specified window. To exit immediately when Cancel is clicked, check for it on the line following the InputBox and issue the Exit function. I would also assume the script should exit if nothing is entered.$Filename = InputBox("Question", "What is the file name you seek?", "Aircraft Name", "", - 1, -1, 0, 0) if @error = 1 or @error = 2 or $Filename = "" Then Exit WinWait('Quattro Pro 12') Phillip Link to comment Share on other sites More sharing options...
BattleOfMoonShae Posted January 22, 2005 Author Share Posted January 22, 2005 Thanks for the help. Got it figured out now. Greatly appreciate the help. 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