How to get cursor position?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
skyth540
Posts: 72
Joined: 24 Aug 2022, 10:07

How to get cursor position?

Post by skyth540 » 02 Nov 2022, 15:12

I am getting familiar with control functions, especially with sendmessage functions. How can I get the caret position (not screen x and y, just how many characters before it)


skyth540
Posts: 72
Joined: 24 Aug 2022, 10:07

Re: How to get cursor position?

Post by skyth540 » 02 Nov 2022, 16:08

just a generic pop up text box, similar to notepad. It's an Edit1 if that helps

what options are there?

User avatar
boiler
Posts: 17385
Joined: 21 Dec 2014, 02:44

Re: How to get cursor position?

Post by boiler » 02 Nov 2022, 17:17

This approach by neogna2 could work for just about anything since it uses Microsoft Active Accessibility info, which all apps are supposed to support.

teadrinker
Posts: 4411
Joined: 29 Mar 2015, 09:41
Contact:

Re: How to get cursor position?

Post by teadrinker » 02 Nov 2022, 18:26

I'd use the EM_GETSEL message.

skyth540
Posts: 72
Joined: 24 Aug 2022, 10:07

Re: How to get cursor position?

Post by skyth540 » 03 Nov 2022, 10:24

teadrinker wrote:
02 Nov 2022, 18:26
I'd use the EM_GETSEL message.
Do you know how to find the 0x???? code? Or what it would be? I can't get the send message to work without it for some reason

teadrinker
Posts: 4411
Joined: 29 Mar 2015, 09:41
Contact:

Re: How to get cursor position?

Post by teadrinker » 03 Nov 2022, 11:45

skyth540 wrote: Do you know how to find the 0x???? code?
What code did you mean?

guest3456
Posts: 3469
Joined: 09 Oct 2013, 10:31

Re: How to get cursor position?

Post by guest3456 » 03 Nov 2022, 11:56

skyth540 wrote:
03 Nov 2022, 10:24
Do you know how to find the 0x???? code?
google:

"em_getsel hex value"
"em_getsel constant definition"


Lepes
Posts: 141
Joined: 06 May 2021, 07:32
Location: Spain

Re: How to get cursor position?

Post by Lepes » 03 Nov 2022, 13:38

guest3456 wrote:
03 Nov 2022, 11:56
skyth540 wrote:
03 Nov 2022, 10:24
Do you know how to find the 0x???? code?
google:

"em_getsel hex value"
"em_getsel constant definition"
google for: "Constantine - Windows API Constants Explorer"

Post Reply

Return to “Ask for Help (v1)”