r3dlined Posted January 5, 2011 Share Posted January 5, 2011 (edited) Has anyone else had the issue of bad window titles being returned? I'll try to add some code here to help to see what I am doing. I have the current window title it is checking returned to see it and sometimes there is a lot of garbage added to the title. I find that restarting or rerunning the script helps, but not always. expandcollapse popupFunc winCheck($winTitle, $winText = "", $exitOnFailure = 1, $winWaitActiveTimer = "default", $logError = 0) Opt("WinWaitDelay", 100) Opt("WinDetectHiddenText", 1) If $wintitle = "Program Manager" Then Opt("WinTitleMatchMode", 2) Else Opt("WinTitleMatchMode", 1) EndIf ;sets to true if exitOnFailure is true, but the active window is a message box. $isMsgBox = 0 ;if the timer has not been overriden it will setill be zero If $winWaitActiveTimer = "default" Then $winWaitActiveTimer = Lookup("Settings.WinWaitDuration") EndIf LogDebug("Starting window check on " & $winTitle & " " & $wintext) ;if the window exists check that it is active If Not WinWaitActive($winTitle, $winText, $winWaitActiveTimer) Then ;This means we tried to close down all windows in HBB and had a failure winCheck("Horizon Blood Bank - Program Manager") If StringInStr($wintitle, "Program Manager", 1) or StringInStr($wintitle, "Warning Code: RE28", 1) Then ;If $wintitle = "Horizon Blood Bank - Program Manager" Or $wintitle = "Warning Code: RE28" then LogTrace("Sending Fatal Error response") FullExit(Lookup("Response.FatalError")) EndIf ;reset the $wintitle so we only move the error box If WinActive("Error", "") Or WinActive("Warning", "") Or WinActive("Info", "") Or WinActive("Question","") Then LogDebug("Moving Error/Warning/Info window.") ;$errorTitle = WinGetTitle("[ACTIVE]") WinMove("[ACTIVE]", "", 0, 0) EndIf If $exitOnFailure Then LogError("Expected window failure. Expected " & $winTitle & " " & $wintext & ". Active window is " & WinGetTitle("[ACTIVE]")) killWindows() fullexit() Else If $logError Then LogError("Expected window failure. Expected " & $winTitle & " " & $wintext & ". Active window is " & WinGetTitle("[ACTIVE]")) SetError (-1) Return 0 EndIf EndIf LogDebug("Completed window check on " & $winTitle & " " & $wintext) Return 1 EndFunc ;==>winCheck Edited January 5, 2011 by r3dlined Link to comment Share on other sites More sharing options...
r3dlined Posted January 7, 2011 Author Share Posted January 7, 2011 No takers on this one? Link to comment Share on other sites More sharing options...
PsaltyDS Posted January 8, 2011 Share Posted January 8, 2011 The only places I see you using WinGetTitle() are two instances of WinGetTitle("[ACTIVE]"). So, what window title is active at that time, and what are you getting instead? Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
r3dlined Posted June 21, 2011 Author Share Posted June 21, 2011 The only places I see you using WinGetTitle() are two instances of WinGetTitle("[ACTIVE]"). So, what window title is active at that time, and what are you getting instead? I'll see if I can reproduce and get the exact return of the window title. It's basically almost correct, what is returned, but there is garbage in it that makes the match fail. Link to comment Share on other sites More sharing options...
PsaltyDS Posted June 21, 2011 Share Posted June 21, 2011 Five months, thirteen days last time. Sooooo, about first week of December? Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law 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