IfWindowOpen function not working

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
ldevito
Newbie
Posts: 10
Joined: Tue Dec 24, 2002 3:16 pm
Location: Long Island, New York

IfWindowOpen function not working

Post by ldevito » Fri Dec 27, 2002 6:08 pm

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

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Fri Dec 27, 2002 7:13 pm

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.
MJT Net Support
[email protected]

ldevito
Newbie
Posts: 10
Joined: Tue Dec 24, 2002 3:16 pm
Location: Long Island, New York

Post by ldevito » Fri Dec 27, 2002 8:26 pm

Thanks for your help. That was it.

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts