Jump to content

MSCONFIG Popup Window Not Being Recognized


KongMD
 Share

Recommended Posts

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?

#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 by KongMD
Link to comment
Share on other sites

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...