Question "Custom URL Scheme"

Hi,
I recently tried activating/calling BTT actions and namend triggers via the “Custom URL Scheme” (e.g. btt://trigger_named/?trigger_name=OpenThisAndThat). This works just fine as long as the called action/named trigger is inside the general tab and not configured as an app-specific command.

My guess is, that by calling the url (btt://xyz), it first opens BTT to execute the defined action. But since BTT is activated first, the “check”, if the application in which the called action is configured in is currently in the front, fails and because of that doesn’t execute the called action.

Is my assumption true? If so, is there a workaround?

unfortunately that is a limitation of custom url schemes in macOS.
A workaround would be to use the integrated webserver in BTT: Using HTTP Requests / Webserver · GitBook (folivora.ai)

I just tested it. Unfortunately, the behavior of the alternative function is identical to the first one. As soon as a trigger is assigned to an app, it doesn't work.

You are sure the app in question is active?

Alternatively you can (with both solutions) trigger using the uuid of a specific trigger via execute_assigned_actions_for_trigger, there the active app doesn't matter

open "btt://execute_assigned_actions_for_trigger/?uuid=C40D3AE2-2F4E-49B1-A00C-F7E4C3632F07"

I am sure that the app is open :wink: Unfortunately, this doesn't work either. I have tried it in InDesign, Photoshop and Illustrator. Alternatively, I also tried it in IINA just to avoid a possible error in the Adobe products. Unfortunately, it also didn't work.

Do you have a concrete example on how you trigger these and what action is assigned? I just tested both ways, but they work as intended here.

(In my test I had a named trigger that executes a keyboard shortcut assigned to Google Chrome, when I execute this in the Chrome console fetch("http://127.0.0.1:50198/trigger_named/?trigger_name=theNamedTrigger") it correctly triggers the shortcut in Chrome

Maybe the method you use for executing the http request, causes an app switch? In that case possibly add a "Activate Previous Window" action as a first action to the action sequence.

I want to execute a BTT command from another app, for example from Keyboard Maestro, the TourBox Console or the Elgato software (I am aware that a plugin exists for this). I have tried using "Open URL" and then copying the link. Perhaps I am misunderstanding something, but as long as the trigger is not specifically assigned to an app, it works. As soon as it is assigned to an app, such as Adobe Illustrator 2023, nothing happens, or rather, it switches out of Adobe Illustrator 2023 and nothing happens. This behavior is identical in all the variants I have tried. Unfortunately, the attempt with "Previous App" also does not work.

Ok the app switch is expected for the custom url scheme and there is no real way to prevent that. Switching back to the previous app should work, but maybe there is some delay needed. Possibly the "Activate Previous App" action would work if the "Activate Previous Window" action doesn't work.

However for the webserver method there is no app switch, thus it should work immediately. The only important thing is to execute the http request in a way that doesn't cause an app switch.
For example if you can trigger a terminal command, you could do it with curl like this (adapt port & trigger name):

/usr/bin/curl "http://127.0.0.1:50198/trigger_named/?trigger_name=THE_TRIGGER_NAME"