I see that @Peter N Lewis's answer from 2011, it's not possible, has already been marked as the accepted solution.
A suggestion was posted to the Keyboard Maestro Forum (https://forum.keyboardmaestro.com/t/move-mouse-cursor-to-text-cursor-position/2232/3) by user sancarn in 2015 which may help if you have Keyboard Maestro available and thus can use its "Click at Found Image" feature:
Have your macro type a “§”. Now you can search the document for the “§” character (either with images or maybe there’s a better way?). Double click on that position then right click on said position. There might be better pictures you can use (like the apple logo ?). Messy work around but it could work! :slight_smile: (Note: I think that may be dependant on font size actually…)
From my experience with Keyboard Maestro's Click at Found Image tool/function/action, yes, you will have to know the font size and colors of the target image and save that either in a file or within the macro definition. If you can narrow down the image search region (easily specifiable in Keyboard Maestro) so that you are searching within as small an area of the screen as possible (e.g. the right half of the middle third of the front app window), that will improve both speed and accuracy of such a macro.
Such a solution may not work for you in your specific use case. I've been looking for a similar solution and this is the best I've found so far (as of 7/2024).
Cmd-?
to open Help menu's search field and type your command instead, or useCtrl-F2
to move the focus to the menu bar and navigate to your desired action there. Or better, assign keyboard shortcuts to often used commands in System Preferences » Keyboard » Keyboard Shortcuts » Applications so you can access them directly.