My script thinks a window is open when it's not?

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
Scones
Junior Coder
Posts: 32
Joined: Fri Jul 05, 2019 11:21 am

My script thinks a window is open when it's not?

Post by Scones » Wed Feb 26, 2020 10:20 am

What MDL are you guys receiving when running this? :shock:

Code: Select all

CloseWindow>Details
Wait 1
IfWindowOpen>Details
MDL>Details open
Else
MDL>Details not open
endif
exit
Do i have some hidden window running called Details? Doesn't show up with getwindowlist

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Re: My script thinks a window is open when it's not?

Post by Marcus Tettmar » Wed Feb 26, 2020 12:58 pm

For me I get an error on the CloseWindow line because there is no window that matches.

So it then gives "Details not open"

If your CloseWindow is not giving an error then you must have a window present that matches.

And if that window hasn't quite finished closing in the millisecond or two it takes for the macro to get to the IfWindowOpen line then you're going to see "Details is open"
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Scones
Junior Coder
Posts: 32
Joined: Fri Jul 05, 2019 11:21 am

Re: My script thinks a window is open when it's not?

Post by Scones » Wed Feb 26, 2020 1:31 pm

I see. Well even if the window is closed from the beginning, the script still sees it.

I wonder how that is possible when it doesn't show up with getwindowlist.

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Re: My script thinks a window is open when it's not?

Post by Marcus Tettmar » Wed Feb 26, 2020 1:39 pm

Try limiting to visible windows only by adding this at the top of your script:

Let>WF_TYPE=2
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Scones
Junior Coder
Posts: 32
Joined: Fri Jul 05, 2019 11:21 am

Re: My script thinks a window is open when it's not?

Post by Scones » Wed Feb 26, 2020 1:45 pm

Try limiting to visible windows only by adding this at the top of your script:

Let>WF_TYPE=2
Works like a charm! Thank you very much! :D

DreamTheater
Newbie
Posts: 19
Joined: Mon Oct 14, 2019 6:23 am

Re: My script thinks a window is open when it's not?

Post by DreamTheater » Fri Feb 28, 2020 6:08 am

Some web systems have hidden windows in the background which could cause this, especially Siebel based systems.

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