Window response

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
buda56
Junior Coder
Posts: 20
Joined: Thu Aug 07, 2008 10:45 am

Window response

Post by buda56 » Tue Oct 07, 2008 1:46 am

Hi,
I am looking for information on how to determine when a window has become active after being non responsive.
I have an application that after you open it you can specify some search criteria the application goes off to a database to return the required search results. Whilst this happens the application becomes non responsive unitl either a timeout occurs or the search results are returned.

What i would like to be able to do is monitor the application window and when it becomes responsive again carry out further actions (like download the returned search results).

Regards..
Peter

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

Post by Marcus Tettmar » Tue Oct 07, 2008 5:10 am

Is there not some kind of status indicator? Does part of the window become disabled, like a button? Use Image Recognition.

Unusual for a window to not change at all and just become unresponsive. But if that is the case I guess you could have the script keep trying to click a button (or try to initiate whatever the next step is) and monitor the outcome, if the button click is successful you know the app is responsive and ready for the next step, if not, loop back and keep trying. Again you could use image recognition for this.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

buda56
Junior Coder
Posts: 20
Joined: Thu Aug 07, 2008 10:45 am

Window non responsive

Post by buda56 » Tue Oct 07, 2008 5:56 am

Thanks for the response..

The application in question is an old 32 bit application and whilst it is busy waiting for a return from the database or a timeout it becomes unresponsive.

In Vista if you click the application window the title bar display the "no repsonse" message

The query that your waiting for displays in a list box above the selection criteria fields (if that makes sense) when it is returned or a popup box will show if the timeout is exceeded with the message "Search has been cancelled".

I was hoping that there was some sort of "waitforwindow" event that I could monitor.

Regards..
Peter.

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

Post by Marcus Tettmar » Tue Oct 07, 2008 6:37 am

Without seeing the app I can't give the definitive solution - and there are always more than one anyway - but it sounds like WaitScreenImage would do the job. You need to make the script wait until the results have appeared, or something else that occurs to indicate completion. Or wait for the timeout window to popup, or not.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

buda56
Junior Coder
Posts: 20
Joined: Thu Aug 07, 2008 10:45 am

Post by buda56 » Tue Oct 07, 2008 7:13 am

Marcus,
Thanks for the update, I've just had a better look at some of the wait commands and will try to see if I can utilise one of those.

The "WaitWindowChanged" looks promising, as the application title bar text changes once the window becomes responsive i.e. the Title shows the returned number of records within the title text.

I'll let you know what happens..

Regards..
Peter

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

Post by Marcus Tettmar » Tue Oct 07, 2008 7:25 am

buda56 wrote:The "WaitWindowChanged" looks promising, as the application title bar text changes once the window becomes responsive i.e. the Title shows the returned number of records within the title text.
In that case you could use this code too:

Code: Select all

GetActiveWindow>title,x,y
Label>wait_until_done
Wait>0.5
GetActiveWidow>new_title,x,y
If>title=new_title
  Goto>wait_until_done
Endif
Just a simple loop which keeps looping until the active window's title has changed.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

buda56
Junior Coder
Posts: 20
Joined: Thu Aug 07, 2008 10:45 am

Post by buda56 » Wed Oct 08, 2008 1:33 am

Marcus,
Thanks for the code, I have tried several diffferent ways today to get the macro to respond to the window when it becomes active and nothing seems to work.

Here's a segment of my code..
WaitWindowOpen>Load Query
wait>1
Send Character/Text>Tasks Closed1.vql
Press Enter
wait>5
SetFocus>CAMS - AP*
WaitWindowChanged>
SetFocus>CAMS - AP*
Press ALT
Send Character/Text>P
Release ALT
WaitWindowOpen>Print*

Regards..
Peter

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

Post by Marcus Tettmar » Wed Oct 08, 2008 7:49 am

Can you send some screenshots? Or contact support and we'll hook up and view your screen. Otherwise we're playing a bit of a guessing game and only able to suggest things you might try rather than seeing the windows and being able to provide a precise solution.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

buda56
Junior Coder
Posts: 20
Joined: Thu Aug 07, 2008 10:45 am

Post by buda56 » Thu Oct 09, 2008 12:44 am

Marcus,
Where can I send the screen shots to is there an email eddress?? as it looks like i cannot upload them from here..

Regards...
Peter

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

Post by Marcus Tettmar » Thu Oct 09, 2008 6:02 am

Support AT mjtnet.com
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

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