Hello
I recently got a new PC at work and a script I created years ago stopped working. Specifically the script seems unable to find an open window using:
If WinExists("[REGEXPTITLE:(?i).*Processing.*?]") Then Local $hWnd1 = WinGetHandle("[REGEXPTITLE:(?i).*Processing.*?]") WinWaitNotActive($hWnd1, "",150) EndIf
The program I'm monitoring is running 3 reports for me. I don't want to sit here and run and export them myself 3x a day everyday, so this script was written to handle it for me. When I moved to the Win7 PC I just copied my script and downloaded the latest version of AutoIT. I'm running this directly from the editor. Here's most of the code to wait on the processing windows to close and then perform a mouse click to export the report:
Sleep(500) ;give the first "Processing..." window time to pop up Local $hWnd1 = WinGetHandle("[REGEXPTITLE:(?i).*Processing.*?]") WinWaitNotActive($hWnd1, "",150) ; Timeout after 150 seconds - since that would mean there is an issue $hWnd1 = 0 ; reset window handle for next processing window If WinExists("[REGEXPTITLE:(?i).*Processing.*?]") Then Local $hWnd1 = WinGetHandle("[REGEXPTITLE:(?i).*Processing.*?]") WinWaitNotActive($hWnd1, "",150) EndIf $hWnd1 = 0 If WinExists("[REGEXPTITLE:(?i).*Processing.*?]") Then Local $hWnd1 = WinGetHandle("[REGEXPTITLE:(?i).*Processing.*?]") WinWaitNotActive($hWnd1, "",150) EndIf $hWnd1 = 0 If WinExists("[REGEXPTITLE:(?i).*Processing.*?]") Then Local $hWnd1 = WinGetHandle("[REGEXPTITLE:(?i).*Processing.*?]") WinWaitNotActive($hWnd1, "",150) EndIf Sleep(2000) MouseClick("right", 280, 174, 1, 20) Send("{DOWN 3}") Sleep(2000) Send("{RIGHT}") Sleep(2000) Send("{ENTER}") Sleep(2000) Send("{ESC}") Sleep(2000) ;all done
I'm using Opt("WinTitleMatchMode", 1).
I can find the window just fine when I'm not using WinExists(). Why doesn't this work after the PC upgrade and how do I fix it?
Thanks for any help!