Gettextatpoint slowness when there is nothing to read

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
remco.remco
Newbie
Posts: 12
Joined: Wed Jul 06, 2016 12:19 pm

Gettextatpoint slowness when there is nothing to read

Post by remco.remco » Wed Jul 06, 2016 12:28 pm

Hi,

I am using GetTextAtPoint to read text from a window. This works perfectly and fast. Usually the text is grabbed within 10ms.
However, I discovered that occasionally there is a huge slowness. I use the command to check if and what text is present at a certain pixel position. At any moment there is NO text at the pixel position, the slowness occurs.
Below a part of my logfile. voorTEXTPOINT is the moment before the gettextatpoint command, naTEXTPOINT after.
The NewResultArray contains the result read. You see that every time there is no result, the read time is about 300ms.
When there is result, e4 in this case, the read time is 1ms!

It looks like the command tries to use other methods to get text if it didn't succeed in first instance?

Hope anyone can help

LOG:

14:06:53:313 - voorTEXTPOINT
14:06:53:615 - naTEXTPOINT
14:06:53:615 - NewResultArray_0
14:06:53:617 - naREAD
14:06:53:618 - loopstart
14:06:53:955 - voorREAD
14:06:53:955 - voorTEXTPOINT
14:06:54:180 - naTEXTPOINT
14:06:54:181 - NewResultArray_0
14:06:54:181 - naREAD
14:06:54:182 - loopstart
14:06:54:530 - voorREAD
14:06:54:531 - voorTEXTPOINT
14:06:54:532 - naTEXTPOINT
14:06:54:533 - e4
14:06:54:533 - naREAD
14:06:54:615 - loopstart
14:06:54:714 - voorREAD
14:06:54:715 - voorTEXTPOINT
14:06:54:717 - naTEXTPOINT
14:06:54:718 - e4



Kind regards,
Remco

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

Re: Gettextatpoint slowness when there is nothing to read

Post by Marcus Tettmar » Mon Jul 11, 2016 2:24 pm

It's probably just that the process you are trying to read text from is busy. Sometimes it works better when we put GetTextAtPoint in a little loop and loop until text is returned.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

remco.remco
Newbie
Posts: 12
Joined: Wed Jul 06, 2016 12:19 pm

Re: Gettextatpoint slowness when there is nothing to read

Post by remco.remco » Tue Jul 12, 2016 1:10 am

Hi Marcus,

It is in a loop. And I tested it separately in a isolated loop. And every time it reads no text, it's slow.
It's looping with 0.1 sec wait time. When there is something to read, it's fast, when there's nothing, it's very slow.


Kind regards,
Remco

remco.remco
Newbie
Posts: 12
Joined: Wed Jul 06, 2016 12:19 pm

Re: Gettextatpoint slowness when there is nothing to read

Post by remco.remco » Tue Jul 12, 2016 1:12 am

Hi,

I now use image recognition in addition. Before I read, I check with image recognition if there is anything to read. If not, I do not read. If there is, I read. This works.

Kind retards,
Remco

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