I have 3 uses of IfWindowOpen. The first works, the other two jump to the False statment.
Note: If you would like the full code to look over, can you please give me an email address to send it to as I don't want to paste it ALL on here. Thank you.
Note: The "SetFocus>loginWindow_hwnd" line brings the required window to the front - but then the IfWindowOpen statement takes the code to the unknownWindow label.Repeat>loopCount
// If Error window open, attempt closeError else attempt normal close.
IfWindowOpen>AGS Error*,closeError,closeAGS
//----------------------------------------------------------------
// Close Error Window
//----------------------------------------------------------------
Label>closeError
.......above code works........
//----------------------------------------------------------------
// Close Ags Main Window
//----------------------------------------------------------------
Label>closeAGS
IfWindowOpen>Analysis Ground Station*
GetWindowHandle>Analysis Ground Station*,analysisWindow_hwnd
Let>WIN_USEHANDLE=1
SetFocus>anaylsisWindow_hwnd
Press ALT
Send>fx
Release ALT
Else
LibFunc>user32,FindWindowA,loginWindow_hwnd,FNWNS390,
//DEBUGGING
message>Login Window Handle is set to : %loginWindow_hwnd% (%loopCount%)
Wait>3
// If Login Window is open, close it, else report an Unknown Window Error and skip AGS run but do End Report
Let>WIN_USEHANDLE=1
SetFocus>loginWindow_hwnd
Let>WF_TYPE=1
IfWindowOpen>loginWindow_hwnd,closeLogin,unknownWindow
Let>WIN_USEHANDLE=0
//----------------------------------------------------------------
// Close Ags Startup Login Window
//----------------------------------------------------------------
Label>closeLogin
........code........
//----------------------------------------------------------------
// Unknown Window Open Error
//----------------------------------------------------------------
Label>unknownWindow
// Ags.exe is running, but script cannot close it because it does not recognise / cannot find the window open.
DateStamp>%errorlog%, !Unknown Window Open Error
My work around for using the loginWindow_hwnd key is:
...but that is tacky!if>loginWindow_hwnd>0,
closeLogin,unknownWindow
I have tried changing the WF_TYPE, I have set and unset WIN_USEHANDLE, I have changed the layout of the IF statements to be over multiple lines rather than one line statements, I have cursed...none of which have had any effect.
Help!
Thanks,
Chris