Getting x,y position of text after doing Text Find in IE6

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
Anomaly Nick
Newbie
Posts: 2
Joined: Fri Jan 30, 2004 1:19 pm
Location: Australia
Contact:

Getting x,y position of text after doing Text Find in IE6

Post by Anomaly Nick » Fri Jan 30, 2004 1:23 pm

Hello, this is my first posting so I hope it has not been discussed before.
I was wondering if there is an easy way of getting the x,y mouse cursor position of the start of some text once it has been located using Text Find (Ctrl-F) in Internet Explorer.
Thanks

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Sat Jan 31, 2004 1:44 am

Try using GetCursorPos function. This returns the X and Y coordinates of the current cursor position. X and Y are variables in which to store the coordinates.

Just a note that you might need to have Explorer window maximized or you may end up with relative values. Something like this:
Let>RP_WINDOWMODE=3 before running MSIE to maximize the window.
Run Program> MSIE
WaitWindowOpen>WebPage*
SetFocus>WebPage*
Find.....text.
GetCursorPos>X,Y
.....
.....
WaitWindowClosed>WebPage*
Let>RP_WINDOWMODE=1 (to return to normal mode)
==================================

Note that syntax on Let, Run Program, Find are not correct, just here for quick example of how to use them.
Last edited by Bob Hansen on Sat Jan 31, 2004 10:55 pm, edited 1 time in total.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

Anomaly Nick
Newbie
Posts: 2
Joined: Fri Jan 30, 2004 1:19 pm
Location: Australia
Contact:

Post by Anomaly Nick » Sat Jan 31, 2004 10:07 pm

Bob,
Thanks for your reply.
I was aware of the GetCursor function but the trouble is that Find doesnt move the cursor to the text found.

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Sat Jan 31, 2004 11:08 pm

Aha, I understand. Good problem, gotta think about that one some more.

:idea: Don't know what you are going to do when you get there, but if need to do something like CTL-C to copy, have you considered doing View, Source on the web page, and then doing your search with something like TextPad? When TextPad finds a match, the cursor goes to the selection that is matched.

I use TextPad daily with Macro Scheduler to perform all types of Sensible Solutions. My two favorite utilities.

Macro Scheduler could open the view source, Select All, Copy to clipboard, open TextPad, Paste from clipboard, do Find, Get postion of mouse, and continue to copy/paste somewhere, continue from that point, save results, close TextPad and close MSIE when all done.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

tommytx
Pro Scripter
Posts: 61
Joined: Mon Dec 22, 2003 3:20 am

Post by tommytx » Mon Mar 08, 2004 8:43 pm

Isn't that coincidental, you are working on similar problem as mine located at the recent title post:Acess no name forms via script.
Study my notes and it may help you.
Is the page you are searching framed or not.
If it is not framed, once you alt e f and enter the text to find, once the found text is highlighted you can give the command Press Tab and that will move the cursor to the location of the hilited text. Now that the cursor has jumped to the found text it is a simple solution to ask for the x,y positon of the text. Tab may cause the cursor to go to the end of the found text, but you can subtract the # of characters in the found text to get the start point.
However if the page is framed as in my example at ACESS NO NAME FORMS VIA SCRIPT... then when you command Tab, the cursor jumps to the first form field on the page and won't jump to the highlighted text.

Let me know if this helps, and if you study my problem and have any ideas, I would love to hear them.

I really believe this is your solution (at least if not framed) so if you don't thoroughly understand what I am saying, let me know and I will try to explain in another way.


Tom

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