I've been struggling to get GetTextInRect to return anything in the result. I've played around with all sorts of rectangles on the screen in various places with various types of text, but the result string is ALWAYS empty. I'm using GetTextInit just before the call, like so:
Label>WaitForLogin
FindImagePos>%BMP_DIR%\login.bmp,SCREEN,0.7,3,XArr,YArr,NumFound,CCOEFF
If>NumFound>0
GetTextInit
GetTextInRect>XArr_0, YArr_0+3,XArr_0+200,YArr_0+23,strResult
**BREAKPOINT**
If>strResult<>
UserName=strResult
Else
Goto WaitForLogin
EndIf
Else
Goto>WaitForLogin
EndIf
I'm sure my rectangle is the appropriate size. It encompasses a TextBox input control for the Username of a login screen. I'm trying to trap the name of the user logging in to an app. I've swapped out the given rectangle for exact coordinates all of the screen just trying to capture something. I've tried the "Username" label above the TextBox input. I've tried MS's Debug menu option, I've tried text in the MS Editor. Nothing seems to work. I'd like to get it to at least return something so I can prove that it would work.
BTW, it's version 14.2.03
Any help is appreciated.
-Kevin
Problem with GetTextInRect
Moderators: Dorian (MJT support), JRL
-
- Newbie
- Posts: 5
- Joined: Mon Dec 16, 2013 5:56 pm
- Location: Richardson, TX, USA
- Contact:
Problem with GetTextInRect
Kevin K Alexander
Re: Problem with GetTextInRect
What version of Windows?
-
- Newbie
- Posts: 5
- Joined: Mon Dec 16, 2013 5:56 pm
- Location: Richardson, TX, USA
- Contact:
-
- Newbie
- Posts: 5
- Joined: Mon Dec 16, 2013 5:56 pm
- Location: Richardson, TX, USA
- Contact:
Re: Problem with GetTextInRect
I've done some experimentation. I finally got GetTextAtPoint to return the label to the TextBos of "Username". I found that I had to use hard coded coordinates rather than calculated coordinates like I was trying in the sample code. Once I moved the point down into the TextBox, I still got nothing. So, that tells me that I cannot read text out of this TextBos control (?).
I've proven GetTextAtPoint works, and it works on this screen but it just doesn't work in the TextBox. I still can't get GetTextInRect to return anything, but GetTextAtPoint would work if needed. I guess I'm just out of luck with this control.
I've proven GetTextAtPoint works, and it works on this screen but it just doesn't work in the TextBox. I still can't get GetTextInRect to return anything, but GetTextAtPoint would work if needed. I guess I'm just out of luck with this control.
Kevin K Alexander
Re: Problem with GetTextInRect
Is incorrect syntax, you can't do math the way you are attempting to do it in each parameter, plus you have an extra space in front of YArr_0+3.GetTextInRect>XArr_0, YArr_0+3,XArr_0+200,YArr_0+23,strResult
Try doing the math on separate lines creating new variables then using those variables as the GetTextInRect parameters.
For example:
Code: Select all
Let>ULx=XArr_0
Let>ULy=YArr_0+3
Let>LRx=XArr_0+200
Let>LRy=YArr_0+23
GetTextInRect>ULx,ULy,LRx,LRy,strResult
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Re: Problem with GetTextInRect
Or you can do it on one line like this:
GetTextInRect>XArr_0,{%YArr_0%+3},{%XArr_0%+200},{%YArr_0%+23},strResult
GetTextInRect>XArr_0,{%YArr_0%+3},{%XArr_0%+200},{%YArr_0%+23},strResult
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?