I have the following code in my macro that downloads 4 reports to my PC and emails them out. I have recently discovered that if a report is blank, I get a pop up window called CPSI Notification that tells me the document was blank. This of course completely messes up my macro. The purpose of the code below is to close this window and continue on with my macro. The GoSub routine is called after every report is downloaded so that I can check for the pop up window (the pop up window displays after the report is attempted to be dowloaded). However, when I run this code, I get a message window from MacroScheduler saying that the window was not found, Abort or Ignore. This is because the reports are good and no pop up window has occurred. If I click Ignore for each report, the macro continues on fine.
I don't understand why the code below even checks for the pop up window. If IfWindowOpen is not true, the Close label shouldn't even be called. But obviously it is and I am doing something wrong. Any help would be greatly appreciated.
Thanks, Larry
...
GoSub>Enter
...
...
SRT>Enter
IfWindowOpen>CPSI Notification,Close
Label>Close
WindowAction>3,CPSI Notification
Wait>.5
END>Enter
IfWindowOpen function not working
Moderators: JRL, Dorian (MJT support)
Hi,
Whether the window is open or not your code will ALWAYS process the Close label. Read the code below and follow it logically:
IfWindowOpen>CPSI Notification,Close
Label>Close
The IfWindowOpen command will jump to the Close label if the window is open. If the window is not open the script will continue. Since the next line is the Close label anyway, we will always end up there. You need to do something like this:
IfWindowOpen>CPSI Notification,Close
Goto>CPSIClosed
Label>Close
..close the window
Label>CPSIClosed
..the window is closed and we carry on...
So here, if the window is open we jump to Close. If it isn't the script continues to the next line which jumps to CPSIClosed which is after the Close section which closes the window.
Whether the window is open or not your code will ALWAYS process the Close label. Read the code below and follow it logically:
IfWindowOpen>CPSI Notification,Close
Label>Close
The IfWindowOpen command will jump to the Close label if the window is open. If the window is not open the script will continue. Since the next line is the Close label anyway, we will always end up there. You need to do something like this:
IfWindowOpen>CPSI Notification,Close
Goto>CPSIClosed
Label>Close
..close the window
Label>CPSIClosed
..the window is closed and we carry on...
So here, if the window is open we jump to Close. If it isn't the script continues to the next line which jumps to CPSIClosed which is after the Close section which closes the window.
MJT Net Support
[email protected]
[email protected]