First GetTextInRect invocation doesn't work

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
moreira
Newbie
Posts: 2
Joined: Wed Mar 09, 2011 11:46 am

First GetTextInRect invocation doesn't work

Post by moreira » Wed Mar 09, 2011 12:26 pm

Hello.

We are evaluating Macro Scheduler in order to use it for GUI testing in VB .Net WinForms applications.

We are trying to get the warning text that appears in a text box when the validation of the fields in a form fails.

We are using the GetTextInRect command, but it seems that the first call doesn't work properly: sometimes it gets the text, sometimes it doesn't.

The solution was to made a first call in the script which result is discarded, so next calls work as expected.

Can this be a bug?

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 Mar 09, 2011 1:27 pm

Sometimes you need to use these commands in a loop (as the text capture example script does). The reason is that they listen to the TextOut commands called by the application that writes the text out to the screen and you can view these rather like a broadcast. If the system or the app is busy at the exact time you call the GetText.. function the app may not be talking. A nanosecond later and it is.

So sometimes it's worth doing something like:

Code: Select all

GetTextReset

Let>gtRes={""}
While>gtRes={""}
  GetTextInRect>10,10,20,20,gtRes
  Wait>0.02
EndWhile
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

moreira
Newbie
Posts: 2
Joined: Wed Mar 09, 2011 11:46 am

Post by moreira » Thu Mar 10, 2011 9:50 am

Thaks for the quick reply.

It worked!

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