4

Is it possible to use AppleScript, cliclick, or a similar CLI tool to move the mouse pointer to the current location of the blinking cursor?

For example, imagine the cursor is blinking at the position just after the letter I:

I love apples

Using AutoHotKey (AHK) on Microsoft Windows, that is accomplished as follows:

MouseMove, %A_CaretX%, %A_CaretY%, 2  ; 2 is default

On Mac, how could I achieve this?

3
  • 1
    While this is a perfectly valid question, it might if you could explain why you want to move the mouse pointer, in case this is an XY problem and your ultimate goal can be achieved in another way.
    – gidds
    Jul 8, 2022 at 19:54
  • Not the OP, but a use case that I want this for is to quickly move the mouse pointer to where my text cursor is so that I can quickly use macOS magnifcation using Opt-Ctrl. I can move the mouse pointer to such a place using something like KeyMou, but it would be so much faster to just unify mouse pointer location to text location in Emacs, Vim, etc because Vim skills are the quickest way around.
    – Joe
    Jul 12, 2022 at 23:11
  • @mellow-yellow if you find my answer is correct, could you kindly mark it as correct & give it the bounty? Thanks. Jul 13, 2022 at 16:31

1 Answer 1

3
+25

After doing some research, it doesn't seem that this is doable on macOS. While windows can do it easily (I was checking python, to be specific, after AppleScript & bash), macOS does not have such functionality. In AppleScript, in each individual app that supports it, you could read through manuals & manuals of Applescript to just get such an action working in a couple of apps (Pages seems to be one of the more promising ones). But overall, you won't be able to achieve this system-wide.

Another thing - carets are not standard, unlike the cursor. For example, iTerm2 has different carets you can choose from, and some of them act slightly differently to a normal caret.

2
  • I am sorry to hear that as I want the same thing. Thanks for asking anyway.
    – Joe
    Jul 12, 2022 at 23:08
  • I use keyboard maestro and was hoping to find a solution through that, but indeed it is not possible: forum.keyboardmaestro.com/t/…
    – Joe
    Jul 12, 2022 at 23:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .