How to avoid pressed modifier key?

I have configured the shortcut ⌘+F to trigger an applescript that must type "Always" very quickly (tell application "System Events" to keystroke "Always")

I am experiencing some problems when the keystroke is typed while I am still pressing the cmd key.

Is there any way/workaround to virtually release the cmd key? Or is it possible to delay the triggering of the applescript until I release the cmd key? Any idea?

Thanks!

I assume you've already tried this? :slightly_smiling_face:

Otherwise, you could try to use a variable.

In this case you would press Cmd (down/up) and then “F.” Thanks to the variable, the “F” won't be typed, as if cmd were still held down. But since cmd is released, it shouldn't cause problems ... maybe :slight_smile:

there is a new action category in current BTT versions that allows you to trigger when releasing all modifier keys

Alternatively try the „set / press / release modifier keys“ action as first action in your sequence, it can release the cmd key before running the apple script - you might need to experiment a bit with the action‘s settings

@jordikt , just out of curiosity - is this the only action this script does? If yes, why you are not using BTT's action - "Insert / Type / Paste Custom Text"?

That should do the trick. What is that action? I can't find it…

"Inssert/Type/Paste custom text" doesn't make any difference. The problem I have to solve is the cmd key pressed.

Insert/Type/Paste custom text automatically handles pressed modifier keys (at least in common scenarios).

This is the action category I was referencing:

Thanks @Frank1 for you sugegestions. The delay is not a solution, but variable can be an alternative if the actions that Andreas told are not a good oslution

I think this has been possible for a long time with Key Sequence if you set the shortcut to “does nothing.”

This KS is not triggered until cmd is released.

yep, using key sequences this has been possible for a long time :slight_smile:

But why would that work if pausing before the action doesn't work?

The pause gives you enough time to release cmd. :thinking:

Thanks everyone for your help! :grinning_face:

The option to fire the applescript when all modifier keys have been released is perfect.

I added a HUD overlay right when pressing the shortcut to warn that the applescript will not fire until the cmd key is released.

It's perfect for me. I show you a screenshot:

I've said it many times, but I'll say it again. Look, I've been using BTT for years, but BTT always surprises me with new features that I don't know about. I wonder if even Andreas has the list of everything this application can do in his head…

I can delay one second the applescript to be triggered, but it doesn't fix nothing if I hold the cmd key for more than one second.

When I press a shortcut, I always quickly release the non-modifier key, but I tend to hold down the modifier key longer. That's why the delay can fail me.

He has, and he hasn't. One thing is for sure: he has a lot in his head :slight_smile:

Then the pause really doesn't help much. Good that you found a solution.

:grinning_face:
Yes, I think it must be something like this:

Nah, I'm not talking about a solution or making a difference, just tryign to understand why if the script does only that you are not using BTT's action. Like mention - just out of curiosity (well actually maybe this will come in handy in the future for myself as well :smiley: ). Maybe you've hit some issue with BTT's action or there's specific use-case which you have.