Need Test Windows

Ideas for new features & functions

Moderators: Dorian (MJT support), JRL

Post Reply
User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Need Test Windows

Post by Bob Hansen » Wed Feb 04, 2009 3:29 am

While developing scripts on a local machine for a remote client, it is not uncommon to be missing some of the software that is needed on the final system. So, when writing script that needs WaitWindowOpen, WaitWindowClosed, etc., these functions cannot be tested, must be commented out, and testing is delayed until on the actual machine.

Would it be possible to have some type of Dummy Windows that could be used during testing? I want to emulate the missing Windows. These would be replaced with the real Window Names in the final code. How many are needed? I have no idea, but I would think at least 5. Obviously, no limit would be ideal, so number them.

I think they would need some type of parameter so we could designate whether it should simulate Open or Closed. An option for a delay would also allow for testing WW_TIMEOUT values.

Possible WindowName format syntax:
TestWindowx,O will perform as if it is Open
TestWindowx,C will perform as if it is Closed
TestWindowx,O,3 will wait 3 seconds, then perform as if just Opened
Test WindowxC,5 will wait 5 seconds, then perform as if it just Closed

OR, even easier, with a predetermined default delay, and positives for Open, negs for Closed:
TestWindowx,+3 will wait 3 seconds, then perform as if just Opened
Test WindowxC,-3 will wait 3 seconds, then perform as if it just Closed

We could change the delay to simulate a race condition, or make it 0 to simulate a failure.
=========================================================
Example of final code:

Code: Select all

Run Program>QuickBooks2005.exe
Let>WW_TIMEOUT=5
WaitWindowOpen>QuickBooks 2005*
If>WW_RESULT=FALSE,Error

// Save file
Press CTRL
Send>s
Release CTRL
WaitWindowOpen>Save*
Send>%FileName%
Press ENTER
Let>WW_TIMEOUT=30
WaitWindowClosed>Save*
If>WW_RESULT=FALSE,Error

//Close Program
Press ALT
Press F4
Release ALT
WaitWindowClosed>QuickBooks 2005*

Label>Error
would look like this in testing:

Code: Select all

Run Program> QuickBooks2005.exe
Let>WW_TIMEOUT=5
WaitWindowOpen>TestWindow1,+2
If>WW_RESULT=FALSE,Error

// Save file
Press CTRL
Send>s
Release CTRL
WaitWindowOpen>TestWindow2,+4
Send>%FileName%
Press ENTER
Let>WW_TIMEOUT=30
WaitWindowClosed>TestWindow2,-8
If>WW_RESULT=FALSE,Error

//Close Program
Press ALT
Press F$
Release ALT
WaitWindowClosed>TestWindow1,-2

Label>Error
An improvement on the suggestion above would be to use any Name as long as it was prefaced with Test. If Window Name was entered without the trailing parameters, then it would be considered a literally correct Window Name, and not a test name. That would also allow for backwards compatibility, and windows whose real name begin with Test. Or use a symbol string like "~~~" for a preface.

Not limited to WaitWindowOpen/Closed, but for otherl commands using a Window name. I can see this with WaitWindowChanged, IfWindowOpen for example.

Don't have all the answers yet, still developing the questions.

Thanks again for listening.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

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 Feb 06, 2009 11:00 am

Could you not use custom dialogs to create test windows specific for the process you are building. You could create an EXE which pops up a dialog with the required window name. Make an EXE which taks the window title on the command line. Then you only need one EXE which you can use to simulate any window.
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
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Fri Feb 06, 2009 5:11 pm

Very interesting! I like the way your mind thinks. I think I could also build in the delay feature as a command line variable.

Hmmm, that might work to simulate a window for an application, but not all windows come from command lines. In the simple example I provided, the Save window comes up from a hot-key or a mouse click. What about error message windows that are triggered internally from the application? I frequently need to anticipate/watch/wait for them.

I need to give this some more thought, and especially how to trigger the dialogs.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

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 Feb 06, 2009 5:20 pm

An OnEvent KEY_DOWN event could cause a dialog to appear, simulating a window appearing as the result of a certain key combo.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

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

Random display of dialog popups.

Post by gdyvig » Fri Feb 06, 2009 7:27 pm

Another possibility is to take the EXE Marcus suggested and have it display Dialogs with the titles you expect in a random sequence with random delays between each. If nothing else, it would be more fun to watch.

Gale

User avatar
pgriffin
Automation Wizard
Posts: 460
Joined: Wed Apr 06, 2005 5:56 pm
Location: US and Europe

Post by pgriffin » Mon Feb 09, 2009 2:15 am

Remember SetControlText> ? I have used this in the past to force the name of any current windows to be the names I need for my immediate task (testing being one of them). Takes a little digging in View System Windows, and you'd still have to have some window with which to work...maybe use a few folder browse windows...

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