KongMD Posted January 28, 2012 Share Posted January 28, 2012 (edited) Hi, all. I can't get this popup window to close upon closing MSCONFIG. Specifically, the $findsPrompt var I've assigned to the statement returns 0. I've tried all kinds of Opt modes and such, but the script ends prematurely, before the 5 second timeout has even elapsed. What am I doing wrong? expandcollapse popup#RequireAdmin #include <GuiTab.au3> #include <GUIListView.au3> #include <Array.au3> #include <GUIConstantsEx.au3> ; Opt('WinWaitDelay',250) Opt("WinDetectHiddenText", 1) Opt("WinTitleMatchMode", 2) Opt("WinTextMatchMode", 1) DisableStartupProgs() Func DisableStartupProgs() ;code navigating through MSCONFIG ; Apply ControlClick($configWin, "", "&Apply") Sleep(1000) ; OK $testClick = ControlClick($configWin, "", "OK") Sleep(1000) ;Click Exit without restart, if prompt appears $findsPrompt = WinWaitActivate("System", "", 5) If @error Then MsgBox(64, "error", "There was an error!") ElseIf $findsPrompt = 1 Then Sleep(100) ControlClick($configWin, "", "without restart") EndIf MsgBox(64, "findsPrompt status", $findsPrompt) EndFunc Func WinWaitActivate($title,$text,$timeout=0) WinWait($title,$text,$timeout) If Not WinActive($title,$text) Then WinActivate($title,$text) WinWaitActive($title,$text,$timeout) EndFunc NOTE: I'm compiling the script as a 64-bit executable on 64-bit Windows 7. Edited January 28, 2012 by KongMD Link to comment Share on other sites More sharing options...
kylomas Posted January 28, 2012 Share Posted January 28, 2012 KongMD, IS this the entire script and what is the sequence of events that happens and that you expect? kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
Exit Posted January 28, 2012 Share Posted January 28, 2012 Can't find the $configWin variable.Please post the whole script. App: Au3toCmd UDF: _SingleScript() Link to comment Share on other sites More sharing options...
KongMD Posted January 28, 2012 Author Share Posted January 28, 2012 Thanks for the replies! forumer100 was right, in that I was using the wrong variable there I had to revert to this workaround, though, because WinWait just wasn't recognizing that #32770 popup window. Failed code is at the bottom, commented out: ;This is an ugly workaround, but WinWait doesn't recognize popup windows well. This clicks "Exit without restart" btn, if prompt appears Sleep(2000) $exitDialog = WinGetHandle("System Configuration") $exitBtn = ControlGetHandle($exitDialog, "", "E&xit without restart") ControlClick($exitDialog, "", $exitBtn) ; ;Click Exit without restart, if prompt appears ; $findsPrompt = WinWaitActivate(WinGetHandle("System Configuration"), "", 5) ; MsgBox(64, "findsPrompt status", $findsPrompt) ; If @error Then ; MsgBox(64, "error", "There was an error!") ; ElseIf $findsPrompt = 1 Then ; Sleep(100) ; ControlClick($configWin, "", "without restart") ; Else ; MsgBox(64, "else", "else fires") ; Sleep(100) ; $exitBtn = ControlGetHandle($exitDialog, "", "E&xit without restart") ; ControlClick($exitDialog, "", $exitBtn) ; EndIf Does WinWait have a tendency to fail when retrieving titles from popup windows like this? I haven't had much of a problem using it until now. 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