tell application "System Events"
tell application process "CafeTran"
key down (key code 59)
delay 0.2
key up (key code 59)
delay 0.2
key down (key code 59)
delay 0.2
key up (key code 59)
delay 0.2
keystroke ","
end tell
end tell
But this doesn't work either. I'd be grateful for a solution. If this isn't possible with Keyboard Maestro, would it perhaps be possible with another tool, e.g. Karabiner Elements?
I recall that this sort of thing has been said in the forum to be difficult if not impossible. This discussion might help. However... that Java editor seems to have a non-standard, indeed gimmicky, input method there!
So the character is typed as normal, and then the text cursor is positioned in front of it? Just typing the character and using the left arrow key would surely be quicker, more logical, conventional and convenient! Have I misunderstood?
If the editor is actually offering a feature that is more useful than how I understand your description of it: might there be an alternative (and easier to automate) way of accessing the feature, e.g. through the application's menus?
About the use of the feature: I can tab Control twice and then press the colon key, to place the text cursor immediately before the colon. Or Control twice and then the comma, to place the caret before the comma.
I have always been wary of such novelty shortcut methods, especially if they cannot be easily changed by the user. Keyboard and combined software setups vary more than might be expected, as can the physical and cognitive needs of end users.
If your guess is correct, it should be easy to make a macro that provides that functionality... unless perhaps the editor is not a native MacOS application... which may well be the case.
Would I be right in thinking that the editor is Intellij IDEA, @ALYB?
Since some years now, this isn't necessary anymore. I don't know whether this because of changes in CafeTran Espresso, Java, or Keyboard Maestro. Anyway: I'm happy with it.
And of course, I would use a native Mac editor ... if a good one existed. Now I'm happy that I can use CafeTran at least.