Cannot get this to work: Double tap on Control, followed by comma

My Java editor has a new feature: double tap on the Control key and then type a character, to position the text cursor before that character.

I'm having problems to simulate double tapping on the Control key:


Test - Double tap on Control, followed by comma.kmmacros (2.7 KB)

I've also tried to do this via AppleScript:

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! :thinking: 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?

2 Likes

I’m afraid that you’re right. I’ve requested the developer of my editor to reconsider using double tapping Control as trigger.

1 Like

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 think what is happening is

  1. Ctrl-Ctrl puts the editor into "Find" mode
  2. User keys a character
  3. Editor moves insertion point to to immediately before the next occurrence of that character, and returns to "Edit" mode

I can see that being useful -- but I think that, as you say, @ALYB's falling foul of the Java app being outside the usual Events chain.

A good move. I hope the developer can help.

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.

1 Like

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. :grimacing:

Would I be right in thinking that the editor is Intellij IDEA, @ALYB?

It's CafeTran, a Java app -- and it's caused @ALYB (and us!) more than a few KM-related problems in the past :wink:

1 Like

Abwarten und Kaffee trinken ... (Wait and see and drink coffee ...)

Hope that I still have some Karma points.

1 Like

But fortunately, all of them could be solved with the great help of this super forum :).

In the beginning, years ago, Chris had to create this for me, just to make any macro work:


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.

1 Like

!!!STOP THE PRESS!!!

The developer just answered:

Double pressing CTRL caused some conflicts anyway. In the 12.1.3 update, you can define your own shortcut for this action in Preferences.

Well, isn't that nice :).

2 Likes

To close this topic, this is how I use the new feature, to insert tags (that represent formatting):




1