I am looking to be able to call BTT UUIDs by running either an AppleScript or Bash Script (or something!), but I need it to be absolutely silent. Nothing can pop up when it runs.
Just so nobody wonders about whether I am after something nefarious, here's how I plan to use this: I have a Logitech G604 mouse, which has a lot of buttons that are not recognized by BTT. To get BTT to be able to recognize these buttons, I have used the Logitech software to remap the buttons to multi-modifier keyboard shortcuts, and then in BTT I configured the triggers inside the keyboard section.
This has worked BEAUTIFULLY... 98% of the time anyway. Sometimes the key combinations can cause conflicts for some apps. Though this is super rare, I'd like to rid myself of the limitations of using keyboard shortcuts all together.
So, as Logitech's software also allows buttons to be programmed to open executables (including scripts), I would like a way to be able to link each button to a script, and each script to a UUID from BTT. This way I would even be able to move the triggers over to the Mouse section in BTT and just have things more organized.
I know how to use the "execute_assigned_actions_for_trigger" and how to wrap it in a shell script if needed, but what I absolutely can't seem to get over is on how to have a script run without the terminal / script editor / dock / something else, popping up everytime it is run.
I know that it is possible to run shell commands from within any running apps through the use of system API calls - which is what BTT, Alfred and others do to have scripts run silently in the background. But is there a way to achieve what I am looking to do?
Many thanks!
EDIT: There was a flaw in my logic. Even if I were to get this to work it would be limiting and not desirable. See my post below.
If the Logitech software allows you to open a URL instead, you can try using BTT's Custom URL Scheme (or HTTP request if that doesn't work). Here are the docs for it.
If that doesn't work, do you know that BTT actions can be triggered using Shortcuts? Perhaps, those Shortcuts can then be opened from the Logitech since you can save a shortcut as an app if you like.
Thanks for the reply. I knew BTT had great integration with Shortcuts but I hadn't stopped to check it out up until now. Very cool.
While considering this possibility, I realized that my initial logic was flawed though. Even if I were to manage to assign a mouse button to a UUID, that would mean that I would miss per app or per conditional group functionality from BTT, since the UUID would always point to just one trigger. This means I require a direct & neutral (native) way to have the mouse communicate with BTT, like I currently have by using keyboard shortcuts.
I'm not sure if what I am looking for is possible. Right now I'm wondering whether there are any unused / special case Key Codes (i.e., the numerical codes used by the OS I/O subsystem to identify all the different keys) that could be used for this purpose, but then again there is a chance the Logitech software may not recognize all available keycodes. If it did though, this would be theoretically possible, as far as I understand. I am even picturing a companion app BTT could have to help map the mouse buttons on the third party software, after which BTT could label these however it wants when the user is mapping them in the Mouse section.
Anyway, just thoughts! Would love to hear what others think.
Actually, that's easy to achieve already in BTT. You can create a Named Trigger and trigger that using the Shortcut/Custom URL Scheme. Then you can duplicate the Named Trigger to any of your conditional apps or conditional groups in BTT and BTT will override it automatically. The key here is triggering the action using the name of the trigger and not the UUID.
Just FYI, this hacky solution turned out to not be an efficient/effective/reliable way to tackle this use case. Ended up getting errors and reverted back to keyboard shortcuts - which have been working great for the past 3 years to be honest. I was just trying to see if there was a superior way of achieving this.
Ah! I noticed you went the Shortcuts route. Personally, that'd be less preferable to me as opposed to the URL scheme/HTTP server route which seems to directly call BTT instead of going through Shortcuts. And as great as Shortcuts can be at times, their subreddit is full of minor issues like these where it's all a black hole and hard to figure out why something works only half of the time even when nothing changes in the way we trigger it. I realise Logitech doesn't allow you to open URLs otherwise I guess that'd have been the easiest.
I guess don't try to fix what's not broken is an adage for a good reason after all! But people like us who use apps/solutions like these are eternal tinkerers after all . I know I have done the same more times than I'd care to admit.