Version 13 some text commands causes script to lose focus

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
bnc1
Pro Scripter
Posts: 127
Joined: Sun Jul 31, 2005 5:10 pm

Version 13 some text commands causes script to lose focus

Post by bnc1 » Wed Nov 23, 2011 11:37 am

I am having problems with v13.0.01 scripts that use text commands like gettextatpoint and gettextinrect. These text commands seem to cause the script to lose focus. This does not happen in v12. In the script listed below the send command does not work in v13. Adding a setfocus command after gettextinrec resolves the issue for this simple example. In some of my more complicated scripts that use other applications, setfocus doesnt always work and I need to look for other workarounds like using Lclick . Is this issue with text commands something that can be fixed ? :?

Code: Select all

RunProgram>notepad.exe
waitwindowopen>Notepad*
getactivewindow>win1,xpos,ypos
gettextreset
gettextinrect>0,0,200,200,strtext
send>test message
exit>0


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

Post by Marcus Tettmar » Wed Nov 23, 2011 11:41 am

On x64 the text capture libraries have to launch a proxy .exe to handle retrieval of text from 64 bit apps. The launch of this invisible window probably removes focus.

This will happen when you first load the libraries (using GetTextInit or GetTextReset).

Therefore if you stick a SetFocus after GetTextInit or GetTextReset you should be sorted.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

bnc1
Pro Scripter
Posts: 127
Joined: Sun Jul 31, 2005 5:10 pm

Post by bnc1 » Wed Nov 23, 2011 12:08 pm

mtettmar wrote:Therefore if you stick a SetFocus after GetTextInit or GetTextReset you should be sorted.
hmmm .. actually the Setfocus only seems to work if its placed after the GetTextinRect command. As stated in my initial post, adding setfocus commands does not always work in my situation.

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