GetTextAtPoint returns nothing

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
cshodges
Newbie
Posts: 2
Joined: Wed May 07, 2008 4:43 pm
Location: San Diego, CA

GetTextAtPoint returns nothing

Post by cshodges » Wed May 07, 2008 5:52 pm

I had a script I made on a trial version that used GetTextAtPoint to make sure the mouse was at the right spot on a web page. Worked great.

Then I registered and upgraded to 10.1.02 and it just stopped working. Searching the forums revealed a different issue related to the same command: Known issue in 10.1: Some apps report error on exit

On a whim, I grabbed those old DLL's, and it fixed my problem too. GetTextAtPoint returns a value with the older DLL's, but only an empty string with the ones that come with 10.1.02.

Hopefully this is on the list to be fixed along with the other issue?

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 May 07, 2008 6:46 pm

It's possible that it's just a coincidence - it is possible that the new DLLs failed to register when you installed the full version and changing them over freed things up. But we'll keep an eye out for any similar problems.

Dman
Junior Coder
Posts: 26
Joined: Mon Apr 21, 2008 2:46 am
Location: Melbourne, Australia

Post by Dman » Tue Jul 01, 2008 4:59 am

I'm using 10.1.15 and sometimes the GetTextAtPoint returns nothing.. reloading the application fixes it, but its an annoying 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 » Tue Jul 01, 2008 9:32 am

This needs to be on the frequently asked questions list because I'm often answering this. I'll sort that.

Usually this is a timing thing, and GetTextAtPoint needs to be in a loop. The reason is that the app you are getting text from is not reporting it all the time, and the time you perform the GetTextAtPoint you may get nothing back. Run the Text Capture sample and point the mouse at the position and you sould see the text. The reason the Text Capture sample usually works where your script does not is that the sample script is running everything in a loop, so it keeps checking. So we often need to try something like:

Code: Select all

Label>wait_text
  GetTextAtPoint>x,y,text
  If>text=,wait_text
So the script keeps looking until it gets a result. Of course you could build a timeout into this if you want.

But first check with the text capture sample macro and see if you always get a result with that. If so it should work when you use a loop.
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