MACRO: HotKey Multi-Press Template (Double-Press, Triple-Press, Etc.)

Ah well, there we go…
Yes, I thought it would be impossible with KM.

I do have lots of hotkeys and they work well, and have been doing so for years.

But then because of a complex building renovation project around here I needed to type a lot more French than usual. But my keyboard is not Swiss-French, it is UK/US because I need the [ ] { } and so on for programming. No accents.

Apple's original shortcuts for accents are easy to remember but they do need two keystrokes and a modifier key: option-e followed by e to get é for example. Well, try to reply to your notary's messages with lots of é, è, à, ù etc. and not lose your patience.

So I thought: why not use the F-keys for those characters. And it works like a dream, except that the "où" still annoyed me because it occurs so often. That's when I thought to "overlay" some of the accented characters on each other, using a double-press to get the simular but less used forms, e.g. ù on top of û.

Then I looked for a solution and found your template. It took some time to "thaw" it out so I could understand it (I'm not the type to use a piece of code without knowing what goes on…), but it worked well.
Until the time, soon after, that I began to type faster.

Having those keys makes typing French so much easier that it's hard to imagine not having them. I'll just be a little careful with the ù.

Robert.

Have a look at LiveCode anyway, you may be interested. Applescript and LiveCode have a common ancester in Hypercard, in fact, if you happen to remember Hypercard, LiveCode is Hypercard as it should have been: easy, fast, connected to the internet etc. and it produces real apps for nearly all platforms (including html5!)

Glad that helped! I don't really have time to look at anything right now, I'm busy working on my YouTube channel. The only reason I answered your question is because I got an email when you talked about one of my macros.

Not that I minded answering your question - I didn't mind at all. :slightly_smiling_face:

Damn, this is so freaking awesome

1 Like

Hey, this is really great. How can I modify it so that it only reacts to a specific number of taps in quick succession?

I would like to replicate the behaviour of some IDEs where, for instance, double-tapping shift brings up a search bar. Unless I'm missing something, this macro will execute all the way through, no matter how many presses are made? (below the maximum limit, that is.)

Should I just add a 'if hkmpActiveKeypressCount == the_number_I_want, then do my_action' action?

Thanks for your template, it saved me a lot of fumbling around already :slight_smile:

A post was split to a new topic: How Do I Use xKeys with KM?

Was searching for something like this and found this macro. (I'm surprised I did not see this before. I sought I skimmed through the entire section of "Macro Library" before. I guess I probably did not notice it because I did not have the need by then.)

Thanks a lot for all of your excellent macros, @DanThomas.

2 Likes

This seems to be just what I'm looking for. I'm trying to allow single/double taps on my Stream Deck, but rather than using the device key trigger or a hotkey, I'm trying to use @corcules' KMLink plugin to pass TriggerValues onto KM. For context, the buttons on my Stream Deck contain the KMLink plugin, each passing on a TriggerValue (via KMLink's Parameter) that corresponds to the Keystroke I'd like to be simulated. So if the TriggerValue is f1, then one tap will simulate the hotkey F1 and two taps will simulate alt+F1.

@DanThomas, perhaps your macro only works with hotkeys or perhaps I've made an error, but I've set it up according to @JMichaelTX's example and hkmpKeypressCount always comes back as 1.

SD single:double tap.kmmacros (71.5 KB)

As far as I can tell, my original macro should handle this just fine. Assuming the original macro is basically unchanged, all I can think of is to check these actions in the macro:

image

Hi Dan. Thanks for the reply. I checked by changing the trigger to a hotkey and it worked nicely, so the issue seems to be using KMLink as the trigger.

1 Like

For anyone interested, I figured out a workaround for Stream Deck double presses.

Set up as many buttons as you like as hotkey actions in Stream Deck.
Add all these hotkeys as triggers for the macro.
Press each button once with a Display text in a window action and copy/paste the hotkey as text into the relevant Switch group entries. Example:

Works like a charm! Thanks @DanThomas!

7 Likes