Nuance between SetFocus> and WaitWindowOpen>

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
Armstrong

Nuance between SetFocus> and WaitWindowOpen>

Post by Armstrong » Sun Dec 08, 2002 9:55 am

If a window, say Calendar - Microsoft Outlook, is already opened, what's the difference(s) between: SetFocus>Calendar* and WaitWindowOpen>?

BTW, SetFocus often cause Specified Window "XXXXXXX" not present while WaitOpenWindow works perfectly under the identical condition.

I suppose SetFocus> is a subset of WaitOpenWindow>. That's, WaitOpenWaindow also includes the function of SetFocus. Please correct me if I'm wrong.

SetFocus> is more troublesome in setting focus to a particular window.

Armstrong
Hong Kong

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

Post by Marcus Tettmar » Sun Dec 08, 2002 11:07 am

SetFocus will activate the specified window - i.e. will attempt to make sure it is the foreground window with the focus. WaitWindowOpen simply waits until the window exists but does not activate it or focus it. Both use the same techniques to find the window so are subject to the same rules.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

Armstrong

Post by Armstrong » Sun Dec 08, 2002 12:16 pm

Marcus,

Your explanation makes more sense. On the other hand, in page 79 of command_ref_7.1.pdf, the second paragraph clearly indicates that waitWindowOpen will attempt the setfocus. That's how I was confused. That's why I presumed SetFocus non-performing.

Microsoft Outlook XP is the best target practice to gain in-depth understanding of Macro Scheduler script. Outlook XP alone can open simultaneously multiple windows. In accordance with your clarification, I should write the following code to return back to Calendar window:

WaitOpenWindow>Calendar - Microsoft Outlook
SetFocus>Calendar -Microsoft Outlook

in order to meet the following critieria:

1. The current active window could be any window other than Outlook.
2. Return back to Outlook's Calendar folder/view.


Look forward to your comment. Many thanks in advace.

Armstrong Wong
Hong Kong

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