GetTextInRect

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
brentmtc
Newbie
Posts: 8
Joined: Wed Jun 04, 2008 7:20 pm
Location: U.S.

GetTextInRect

Post by brentmtc » Wed Jun 04, 2008 8:51 pm

Trying to create a screen scraping macro that captures text from text boxes on a web-based form and then writes that data to a db. I'm just starting out here. Here is the code I have so far:


//Recorded Events
//Recorded Events
Let>WW_TIMEOUT=5
CapsOff

//Set focus to Appointment Scheduling--------------------------------
SetFocus>Appointment Scheduling*
WaitWindowOpen>Appointment Scheduling*

//Get window position and move mouse to the correct field------------
GetWindowPos>Appointment Scheduling*,WindowX,WindowY
Let>PosX=WindowX+220
Let>PosY=WindowY+191
Wait>0.2
MouseMove>PosX,PosY
Wait>0.2
LClick
Wait>0.8

GetTextInRect>220,191,LastName
MessageModal>LastName

With 220,191 being the X,Y point of the beginning of the text box. When the msg box pop up. It has no data. Any help would be greatly appreciated. :)

Thanks.

-brentmtc

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 Jun 04, 2008 9:02 pm

GetTextIRect requires four points - it gets text from a rectangle. From the help file:
GetTextInRect>left,top,right,bottom,result_variable

Retrieves text found in the screen rectangle bound by coordinates left,top and right,bottom.
So you need to add the right and bottom coordinates:

GetTextInRect>220,191,RIGHT,BOTTOM,LastName

These are screen coordinates.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

brentmtc
Newbie
Posts: 8
Joined: Wed Jun 04, 2008 7:20 pm
Location: U.S.

GetTextInRext

Post by brentmtc » Wed Jun 04, 2008 9:23 pm

Still nothing in msg box. Do I need the left, top,right,bottom of each txt box with many GetTextInRect> code blocks for each txt box?

GetTextInRect>220,191,892,448,LastName
MessageModal>LastName

Thanks. :)

-brentmtc

fightcancer
Macro Veteran
Posts: 249
Joined: Fri Apr 15, 2005 8:32 am

Post by fightcancer » Fri Oct 03, 2008 10:12 pm

Same issue here. The result variable for GetTextInRect occasionally seems to be empty. This is a recurring, random issue for me. Will do some research on the forums.

(MS 10.1.21e. Have GetWordNT.dll and ICall.dll in the MS root dir.)

Will continue my updates here.
http://www.mjtnet.com/forum/viewtopic.php?p=21584#21584

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