WaitWindowOpen/Close if I know last part of the name

General Macro Scheduler discussion

Moderators: JRL, Dorian (MJT support)

Post Reply
rsamour
Newbie
Posts: 8
Joined: Tue Sep 29, 2009 7:54 pm

WaitWindowOpen/Close if I know last part of the name

Post by rsamour » Fri Oct 02, 2009 3:57 pm

Hi,

I tried to use WaitWindowOpen> with an argument as *name. i.e. I know the last part of the name instead of what it begins with. That did not work. Is there a trick to wait for a window when I do not know what will it begin with?

Thanks,
Raymond

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

Post by Marcus Tettmar » Fri Oct 02, 2009 5:02 pm

Use:

WaitWindowOpen>name*
If the last character of the window title specified is an asterisk (*), Macro Scheduler will attempt to setfocus to the first window whose title matches the text entered exactly. If it cannot make an exact match it then looks at all windows and sets focus to the first one it finds whose title contains the entered text. This solves the problem with applications such as Word or Netscape which change their titles depending on the document loaded. It is best to try to provide an exact (including case) window title to ensure the correct window is found, as many applications have multiple invisible windows with similar names. Specifying text without a trailing asterisk will force Macro Scheduler to only look for an exact match.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

rsamour
Newbie
Posts: 8
Joined: Tue Sep 29, 2009 7:54 pm

Post by rsamour » Fri Oct 02, 2009 6:26 pm

Hi Marcus, I gather your read my question rather quickly :-) . What I know is that the title will be "*name" and NOT "name*" i.e. the first part of it is a variable and the second part is a fixed name.
Is there a way of waiting for a *name window?

Thanks again,
Raymond

gdyvig
Automation Wizard
Posts: 447
Joined: Fri Jun 27, 2008 7:57 pm
Location: Seattle, WA

Post by gdyvig » Fri Oct 02, 2009 6:54 pm

Hi rsamour,

The Macro Scheduler trailing wildcard actually means "contains", not "starts with" as you might suppose.

Let's say exact window title is "The name of the game"

The following statements will wait for the above window:

WaitWindowOpen>The name of the game
WaitWindowOpen>The name*
WaitWindowOpen>name*
WaitWindowOpen>game*

Where you can have a problem with this wildcarding scheme is when there are other open windows with similar names, like:
"The game is name"
"The name game"
"My name is Sue, how do you do?"

Do a search on wildcards and you will find some further discussion on this issue.


Gale

rsamour
Newbie
Posts: 8
Joined: Tue Sep 29, 2009 7:54 pm

Post by rsamour » Fri Oct 02, 2009 7:12 pm

Thank you Gale. I actually tried your suggestion before as I suspected that it is what Marcus had meant and it did not work. I waiting for an IE to open by specifying "Windows*", Windows Internet*" and "Windows Internet Explorer*" and all did not work. After receiving your reply I waited by specifying "- Windows*", it worked. No idea why but it works.

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

Post by Marcus Tettmar » Fri Oct 02, 2009 7:20 pm

rsamour wrote:Hi Marcus, I gather your read my question rather quickly :-) . What I know is that the title will be "*name" and NOT "name*" i.e. the first part of it is a variable and the second part is a fixed name.
Is there a way of waiting for a *name window?
No, I read your question carefully. I could accuse you of what you accused me and say that you read the documentation too quickly. But that might be considered rude. Instead I'll paste the documentation below again and this time I'll emphasise the key words:
If the last character of the window title specified is an asterisk (*), Macro Scheduler will attempt to setfocus to the first window whose title matches the text entered exactly. If it cannot make an exact match it then looks at all windows and sets focus to the first one it finds whose title contains the entered text. This solves the problem with applications such as Word or Netscape which change their titles depending on the document loaded. It is best to try to provide an exact (including case) window title to ensure the correct window is found, as many applications have multiple invisible windows with similar names. Specifying text without a trailing asterisk will force Macro Scheduler to only look for an exact match.
It means "contains the proceeding text".

If it "does not work" and does not say that no window was found then that means it found some other window. There are bound to be dozens of windows, hidden or otherwise, on your system with the word "windows" in it and certain more than one with "windows internet" in the title. Narrow down your search and/or use the WF_TYPE flags (use the one that is for visible windows only). The visible IE container window you are wanting to find has "- Windows Internet Explorer" in the title, with the first part being the title of the active page. This is unique compared to the other "windows internet" windows. Look in Tools/View System Windows to see what I mean. Hopefully that explains why your first attempt failed. But perhaps I have read your email too quickly and failed to explain myself again. ;-)
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

rsamour
Newbie
Posts: 8
Joined: Tue Sep 29, 2009 7:54 pm

Post by rsamour » Fri Oct 02, 2009 7:40 pm

OK. I feel embarrassed. :oops: Thank you Marcus and Gale.

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