find text on webpage & move cursor to that position Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
arathra
Posts: 23
Joined: 29 Aug 2016, 06:22

find text on webpage & move cursor to that position

31 Jan 2018, 07:45

This is what I'm trying to do

1. Open a webpage (no problem)
2. Send Crl-F a do a search for, SEARCHWORD on the webpage - the word is then highlighted on the page (I'm using Opera BTW) (no problem)

This works fine in AHK but then I'd like to

3. Move the cursor to the highlighted text on the page.

I can't for the life of me work out how to get the coordinates of the highlighted text - or even if it's possible.

Any suggestions welcome!
User avatar
boiler
Posts: 17387
Joined: 21 Dec 2014, 02:44

Re: find text on webpage & move cursor to that position  Topic is solved

31 Jan 2018, 10:21

If the color of the highlight is unique, then you can find it using PixelSearch. But I prefer grabbing several pixels in a row as a reference image and using ImageSearch. That will more reliably find your highlight and not a stray pixel that happens to be the same color, which can happen at the edges of anti-aliased text or in some random image.
arathra
Posts: 23
Joined: 29 Aug 2016, 06:22

Re: find text on webpage & move cursor to that position

31 Jan 2018, 10:47

That's a REALLY interesting idea. I've not used ImageSearch before but I do think it will work in my case.

Thanks!!
Guest

Re: find text on webpage & move cursor to that position

01 Feb 2018, 08:59

boiler wrote:If the color of the highlight is unique, then you can find it using PixelSearch. But I prefer grabbing several pixels in a row as a reference image and using ImageSearch. That will more reliably find your highlight and not a stray pixel that happens to be the same color, which can happen at the edges of anti-aliased text or in some random image.
Hey, boiler. I'm also interested in a script similar to this but in the sense that. Once a certain text is detected/found on-screen, a key that I have assigned will be automatically entered into a text box. I play a virtual game online to which this would be very handy in. Ok so for example: The script detects the word 'China' and then it automatically enters 'Beijing' into my textbox. It's like a trivial game in which you give the world capitals of a certain country. So what I would like in summary is a script which inputs my assigned word when the corresponding text is detected on-screen.

Summary script (does not make sense, but is pretty much the gist of what I want):
ScreenDetects, England
InputWord, London
Guest

Re: find text on webpage & move cursor to that position

01 Feb 2018, 09:21

Gregster, why you all up in my shit? It is evident in numerous threads that you're fund of this behavior. Go peep in someone elses business. Thanks.
gregster
Posts: 9111
Joined: 30 Sep 2013, 06:48

Re: find text on webpage & move cursor to that position

01 Feb 2018, 09:23

Because you are posting duplicates over and over.
Guest

Re: find text on webpage & move cursor to that position

01 Feb 2018, 09:32

gregster wrote:Because you are posting duplicates over and over.
Don't be dumb. Your attitude started from my first thread when you hadn't even seen this one.
gregster
Posts: 9111
Joined: 30 Sep 2013, 06:48

Re: find text on webpage & move cursor to that position

01 Feb 2018, 09:34

That is true. I asked you how that was an [URGENT REQUEST]? I am still waiting for a meaningful answer. There is also the question why you are posting the same thing three times in 18 minutes? And finally, do you think your kind of behaviour will have a positive influence on your requests?

But I can recommend the tutorial. if you would like to give some meaning to the potential waiting time...
User avatar
boiler
Posts: 17387
Joined: 21 Dec 2014, 02:44

Re: find text on webpage & move cursor to that position

01 Feb 2018, 10:26

Manlikezab12 wrote:Hey, boiler. I'm also interested in a script similar to this...
gregster is not out of line. Please don't spam the forum with the same question, especially when you haven't given any time to answer and especially not in other people's threads when you already have your own thread.
User avatar
boiler
Posts: 17387
Joined: 21 Dec 2014, 02:44

Re: find text on webpage & move cursor to that position

01 Feb 2018, 11:32

You need to take a reference image of the name of each country that may appear. Then your script will do an ImageSearch for each of those country names, and when one appears, then it would send the name of the capital corresponding to that country. If you don't have access to all the images of the country names in advance, then ImageSearch is of no help, and it's a much more complicated problem. You could use OCR and whitelist the names of the possible countries to make it reliably pick names from that list, then when it matches one, you send the capital name.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: No registered users and 399 guests