Suggested new function - WaitWindowFocused>

Ideas for new features & functions

Moderators: Dorian (MJT support), JRL

Post Reply
User avatar
JRL
Automation Wizard
Posts: 3501
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Suggested new function - WaitWindowFocused>

Post by JRL » Tue Jan 28, 2014 4:02 pm

I find myself often trying to efficiently determine when a window that is already open has regained focus. Generally this uses GetActiveWindow> in a loop testing for "Window Name" is active. This is complicated when window names vary because they have dates or times or work order numbers or etc in the window name.

It would simplify many of my scripts if there was a WaitWindowFocused> function that used the same window name wildcard and timing facilities as other window functions.

Code: Select all

WaitWindowFocused>Updating WO:*
Rather than

Code: Select all

Label>WaitForUpdatingWO
GetActiveWindow>WinTitle,WinX,WinY
Separate>WinTitle,Updating WO:,WaitUWOres
If>WaitUWOres_Count>1
Else
  Wait>0.5
  Goto>WaitForUpdatingWO
EndIf

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

Post by Marcus Tettmar » Wed Jan 29, 2014 9:23 am

Noted, thanks.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

User avatar
JRL
Automation Wizard
Posts: 3501
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Wed Jan 29, 2014 1:45 pm

Thank you for the greatest support of the most useful software ever invented.

User avatar
jpuziano
Automation Wizard
Posts: 1085
Joined: Sat Oct 30, 2004 12:00 am

Post by jpuziano » Fri Jan 31, 2014 11:20 pm

Great idea for a new function!
The WaitWindowOpen function uses certain system variables - Help File Out-Take wrote:The system variable WW_TIMEOUT can be used to set the number of seconds after which this command should timeout. If set to zero (the default) the timeout will not occur and the command will continue indefinitely. If WW_TIMEOUT is used, WW_RESULT will indicate whether or not the command ended successfully. If it timed out WW_RESULT will be set to FALSE. If the window it was waiting for appeared within the timeout setting, the WW_RESULT value will be set to TRUE.
Of course it would be great to have a similar system variables available for use with this new WaitWindowFocused> function... maybe called:

WWF_TIMEOUT
WWF_RESULT

Again, this makes a lot of sense as a function. Thanks JRL for proposing this and thanks Marcus for listening... :D
jpuziano

Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post - :-)

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