Move mouse cursor into text that is highlighted

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
codude
Posts: 128
Joined: 12 Nov 2015, 05:33

Move mouse cursor into text that is highlighted

26 Nov 2015, 09:18

I'm looking for a way to move the mouse cursor into text that is highlighted in a Word doc. Anywhere in the highlighted area is fine.
grant
Posts: 323
Joined: 14 Oct 2015, 17:27

Re: Move mouse cursor into text that is highlighted

26 Nov 2015, 11:16

Pixelsearch comes to mind.
https://autohotkey.com/docs/commands/PixelSearch.htm
Mousemove to move the mouse icon
https://autohotkey.com/docs/commands/MouseMove.htm

You might need get pixelgetcolor to find out what color the highlight is, if the color changes when you move the mouse over it.
https://autohotkey.com/docs/commands/PixelGetColor.htm
Mousegetpos will give you the current location to check for the color
https://autohotkey.com/docs/commands/MouseGetPos.htm


Here is some code to get you started.

Code: Select all

f6::
MouseGetPos, X,Y
msgbox, Move the mouse away from the color, we have the loation at %x%`, %y%
PixelGetColor, color, X, Y
clipboard = %x%, %y% %color%
msgbox, The color is %color% and is located at %x%`, %y%.  I have put this data on your clipboard
return


f7::
msgbox, %color%
PixelSearch, Px, Py, 0, 0, A_ScreenWidth, A_ScreenHeight, %color%,,fast
if ErrorLevel
    MsgBox, That color was not found in the specified region.
else
mousemove, Px, Py
return
codude
Posts: 128
Joined: 12 Nov 2015, 05:33

Re: Move mouse cursor into text that is highlighted

04 Dec 2015, 10:10

The background picture of the highlighted text seemed to remain constant in all situations so the PixelSearch worked fine. Thanks
systema
Posts: 51
Joined: 26 Nov 2015, 03:43
Location: France/Normandie

Re: Move mouse cursor into text that is highlighted

04 Dec 2015, 11:20

I think the keyboard cursor is just before or after the selected text, so "around" A_CaretX, A_CaretY may optimize the search.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: joefiesta, JPMuir, mikeyww, Thorlian and 279 guests