Specific App Did Launch: "Keyboard Shortcut Action" Leads to Four Repetitive Executions

When I use the named trigger "Specific App Did Launch" to automate a few actions upon app launch, the "send keyboard shortcut" action can lead to four repetitive keystrokes in rapid succession.

For example, upon Chrome launch, if I ask BTT to close a Chrome window (Command-W) and then open an incognito window (Shift-Command-N), the latter "send keyboard shortcut" action leads to four repetitions and four incognito windows. This bug is reproducible in many apps, another example being TextEdit. Each time when the bug occurs, the "send keyboard shortcut" action gets executed exactly four times.

I am on the latest BTT/macOS, and have observed this bug for about a month by now, ever since I first started trying "specific app did launch".

@Andreas_Hegenberg Bumping this request up again. This bug is preventing many potential automations for me. Please help.

could you check the latest alpha? possibly this was a side effect of something I fixed decently

It is still problematic, but it seems like the new Alpha changed something. You can reproduce the behavior using "Specific App Did Launch", and use keyboard shortcut Cmd-W followed by Cmd-N. (I tried inserting delays, but it did not help.)

  • TextEdit still has four repeated shortcut actions, like before.
  • Chrome has less actions, but does not end at the shortcut I wanted (no new window in the end).

While we are at this, I also want to mention that we cannot "enable/disable selected trigger" for these named triggers. I can disable keyboard shortcuts or key sequences.This is not a major problem, but it is inconvenient when we are troubleshooting.

I just tried to reproduce it here, but it seems to trigger exactly once. Were you trying v3.725?

Which version of macOS are you running?

Yes, I am on 3.725 and Monterey 12.1.

As I said, I started observing this problem during the winter break. That was the first time I tried "Specific App Did Launch". Note that this bug does not affect every app. Mail seems to get keyboard shortcut just fine. So make sure you try Chrome and TextEdit.

Ah I think I found the issue. It happens when multiple did launch triggers have been configured in BTT.
Version 3.726 is currently building and should be available in ~10 minute. I hope that also fixes the issue for you.

3.726 indeed solved the problem. THANK YOU!!!

1 Like

@Andreas_Hegenberg There seems to be a related bug. Here is what I am trying to do: when a distracting app is launched, a HUD overlay is shown for a few seconds and then a notification is displayed. The HUD overlay works fine, but an applescript display notification ... does not yield any notification. If I use a terminal command instead, the same command with osascript -e 'display notification ...' will yield a notification, but the notification is repeated 2-3 times. Could you look into this issue?

"Specific App Did Launch" can offer some powerful automations, but is buggy for some reason.

when using apple scripts that show any sort of UI make sure to not use the “async” version of the apple script action in BTT.

Does it then still show up repeatedly?

Somehow I missed your reply about a week ago, but here is what I found upon further tests today:

  • AppleScripts still do not work at all. No notification with blocking or asynch.
  • Shell scripts work with just one notification, either blocking or asynch will work.

The multiple notifications I reported earlier seem to be residual effects of disabled triggers (unless there were updates in the past week that I did not know of). I was only able to reproduce the multiple notifications on Google Chrome, for which I had previously set up other "Specific App Did Launch" triggers. After the disabled triggers were deleted and BTT restarted, the notification scripts are now behaving fine.