Page 1 of 1

Select whole words when mouse hovers over

Posted: 24 Jun 2022, 17:30
by Elermino
If the cursor is of the IBeam type and the F20 key is pressed, the text is selected with the shortcut Ctrl + Shift + right (or in the direction to which it is moved).

Is there any way of doing this?
https://imgur.com/a/Rqrfwjk

I have this code but it is based on the number of pixels moved and not on whether the cursor is over a word

Code: Select all

#If WinActive("ahk_exe chrome.exe") && A_Cursor = "IBeam"
~LButton::
Click
MouseGetPos, x1
SetTimer, Check, 100
SoundBeep, 1500
KeyWait, LButton
SetTimer, Check, Off
SoundBeep, 1000
Return
#If

Check:
MouseGetPos, x2
f := Floor(Abs((x2 - x1) / 110))
Switch
{
 Case x2 > x1: Send ^+{Right %f%}
 Case x2 < x1: Send % "{Right}^+{Left " f + 1 "}"
}
Return

Re: Select whole words when mouse hovers over

Posted: 25 Jun 2022, 00:33
by shanshans
Not so sure what you want. If i need to select a word only, point the mouse to that word and double click on it . If it is a sentence triple click.

Re: Select whole words when mouse hovers over

Posted: 25 Jun 2022, 07:39
by Elermino
shanshans wrote:
25 Jun 2022, 00:33
Not so sure what you want. If i need to select a word only, point the mouse to that word and double click on it . If it is a sentence triple click.
I know it is a complicated issue, so I would like to know if there is a way. I half achieved it by sending 2 clicks when the cursor is IBeam (or text) type and when scrolling 50px in one direction I sent the command Ctrl + Shift + (left or right depending on the direction in which it goes), but it does not work like I want is to select the word when hovering over it. I appreciate any help