Move mouse cursor into text that is highlighted
Move mouse cursor into text that is highlighted
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.
Re: Move mouse cursor into text that is highlighted
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.
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
Re: Move mouse cursor into text that is highlighted
The background picture of the highlighted text seemed to remain constant in all situations so the PixelSearch worked fine. Thanks
Re: Move mouse cursor into text that is highlighted
I think the keyboard cursor is just before or after the selected text, so "around" A_CaretX, A_CaretY may optimize the search.