It is not possible to perform a left mouse click on the current keyboard text insertion position

Would it be possible to implement it?

Yes:
Move or Click Mouse Action (v9.0.5)

Move or Click Mouse.kmactions (972 B)

I should have been more specific. In fact, I meant the keyboard cursor, not the mouse cursor.

There doesn't seem to be any way to perform a click on the keyboard cursor's position

I don't even know what a "Keyboard Cursor" is. :slight_smile:

I am not sure if it goes by any other name.

The keyboard cursor is the position at which a letter pressed on the keyboard will be inserted.

It used to be called “insertion point” because that’s where text would be inserted if you typed as you say.

Can I ask, why do you want to click there?

1 Like

Possibly to ensure the rest of the macro inserts text at the right place.

I understand. Does the app that is to receive the typing have more than one text-entry field? If not (say like textedit) then all you need do is ensure the app’s window is frontmost and any typing will go to where the cursor is. Apologies if I’m being a bit simplistic.

If you can code the macro to the right location, you can use the insertion point token %|% in an action to take it from there.

I've never come across %I%: where's that in the WiKi?

My use case is that I have a series of interconnected text files. The link to each file is in the form of specially formatted text such as [[Link to Other File]]. When I click on this, it takes me to the other file. I would like to do that without lifting my keys from the keyboard.

I get that jumping between keyboard and mouse is a pain :crazy_face:

What App are you using? I’ve done a quick trawl of wiki-like apps to gather more info but there are so many: can you be a bit more specific please?

Thanks for your interest. I am using The Archive (https://zettelkasten.de/the-archive/)

Well, I've found an answer but it's a bit Heath Robinson...

Test.kmmacros (12.4 KB)

The macro basically selects a bit of the link using option-left arrow and option-shift-right arrow and then detects the highlight using a found image action. Then it just clicks the mouse near the found highlight which then activates the link.

It's a lot harder to describe!

I've tried it on a few test cases within The Archive and it seems to work consistently.

Things to change:

  1. I've set the macro to trigger using hyperkey-minus so you'll want to set that to suit you.

  2. The highlight colour on my mac is light blue to you may need to change the image to suit the highlight on your mac if it's different.

  3. Make sure you put this macro in a new group that is only active for The Archive.

I think that's all. Let me know how you get on.

I can't find it in the Wiki either. But it's right in any text action:

Screen Shot 2018-02-10 at 9.37.19 AM ×0.5

Thanks for showing me that @mrpasini, I never knew you could do that! There’s so much about KM to learn isn’t there? Unfortunately, for @edoreld ‘s question it doesn’t really help as he definitely needs to click at the insertion point.

I can definitely use your tip in the future though :+1:

There is definitely a lot to learn when it comes to Keyboard Maestro, agreed. And it's a real blessing to have this forum where we can help each other do just that!

1 Like

Well said - keep safe!

Unless the app has very good AppleScript support, no. In general there is no way to determine where the text insertion point is on the Mac.

For this specific case, you might be able to do something like:

  • Command-Left Arrow
  • Command-Shift-Right Arrow
  • Copy
  • Process the text, extract the link, go to that location.

But finding the text insertion point’s location on the screen is not something that can be done easily.

About the only thing I can imagine is having Keyboard Maestro record the screen for a second and try to look for the blinking cursor, which would be a bit of a hack, but might work.

The trouble is the “link” can be the name of a file, the name of another note in the WiKi, or a URL so getting the text doesn’t necessarily help. The app being used needs to receive a mouse click on the link itself, which is why I took the approach I posted previously.

You’d think that an app that encourages users to just use the keyboard would provide a keyboard shortcut to follow a link! Maybe @edoreld should submit a feature request.