How to get caret positon in a text? Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
yfjuu6
Posts: 125
Joined: 28 Apr 2023, 15:28

How to get caret positon in a text?

24 Sep 2023, 14:50

I want to assign a hotkey to do 3 clicks where the caret position is in a text to select a paragraph from a text on "Anki Add editor" (I don't want to press 3 clicks by mouse).

For this purpose :

1- I want to know how to get the caret position in a text

2 - mooving the mouse cursor to the caret position in a text

3 - doing 3 clicks

Somthing like this :

Code: Select all

F12::

CaretPositionX := X

CaretPositionY := Y

MouseMove, X, Y

Click 3

Return
Please help!
GEV
Posts: 1005
Joined: 25 Feb 2014, 00:50

Re: How to get caret positon in a text?

24 Sep 2023, 16:52

Code: Select all

F12::
	MouseMove, A_CaretX, A_CaretY, 0
	Click 3
Return
See https://www.autohotkey.com/docs/v1/Variables.htm#Caret
User avatar
yfjuu6
Posts: 125
Joined: 28 Apr 2023, 15:28

Re: How to get caret positon in a text?

26 Nov 2023, 10:01

GEV wrote:
24 Sep 2023, 16:52

Code: Select all

F12::
	MouseMove, A_CaretX, A_CaretY, 0
	Click 3
Return
See https://www.autohotkey.com/docs/v1/Variables.htm#Caret
Hy!
Do you know how to do so in V2?
GEV
Posts: 1005
Joined: 25 Feb 2014, 00:50

Re: How to get caret positon in a text?  Topic is solved

26 Nov 2023, 12:43

Code: Select all

#Requires AutoHotkey v2.0

F12::{
	If CaretGetPos(&x, &y)
	{
		MouseMove x, y, 0
		Click 3
	}
}
See https://www.autohotkey.com/docs/v2/v2-changes.htm#built-in-variables

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Chunjee, Psych0p4th and 274 guests