Can BTT detect when a particular app tool is "active" and conditionally run a different macro from the same trigger shortcut?

I'm using this with the latest version of Finale (music notation software) in the latest version of OSX. I have a simple shortcut that triggers a long keyboard and mouse macro. I only use it when I'm in a particular tool in Finale, otherwise, the macro would activate and nothing happens. I like the shortcut a lot and I'm wondering if I can use it with multiple actions conditionally set depending on the active tool. So if I'm in Tool X, the shortcut triggers Macro X. If I'm in Tool Y, the same shortcut triggers Macro Y.

I know that when you set two macros to the same trigger, it gives you a menu. I would just want to skip that menu if possible.

Unfortunately that most likely won't be possible. I don't think there is any good way for BTT to know the active tool ;-(

No worries, thanks Andreas!

@syjefroi you might want to look into Keyboard Maestro

It has the ability to read a specified rectangle of the screen - like "From 1080, 600 to 1200, 700" (returning a rectangle of 120 by 100 pixels) and then OCR any text found in that area. Then it can do logic against that text.

Based on that, you might be able to make a macro that scans Finale and works out what Tool is active, by reading the screen where the active tool is displayed (assuming it is), and then making decisions based on that.

Or, if no text is available, you could use the "Find Image On Screen" action and provide it with an icon to look for - which might be able to detect a pressed-in icon versus a not-pressed-in, if you know what I mean. Like, in Photoshop for example, the difference between:

Not pressed icon:

Pressed icon:

So in that example, I'd search for the second image and if it was found, I could conclude that the Brush tool is active. Or actually, a better option at least in Photoshop, would be for me to scan the toolbar at the top of the screen, which shows the active tool - so if I saw the brush icon at the top of the screen, I'd know that brush was active:


You can trigger a Keyboard Maestro macro via any BTT gesture - either by having BTT send a keyboard shortcut, or by using Apple Script or other scripting to trigger KM. Likewise you can have Keyboard Maestro trigger BTT actions using BTT's Scripting API, eg with Apple Script. KM has more advanced menu-making options, so that's something I'm looking at KM for right now: making menus of actions, some of which include BTT actions like screenshot capture.

Note I've never actually done this myself :slight_smile: I only just bought Keyboard Maestro and am still learning it. I also don't use Finale so don't know what it looks like. So it is just an idea to investigate, I can't promise it works in your case specifically.

Doing it based on a part of the screen is actually a good idea and will also be possible with the next BTT alpha! (I made the "Find Image on Screen & Move Mouse" action much faster and more versatile recently, so it will be able to do this easily).

It will allow to trigger a "named trigger" if a specific image is found, and another named trigger if not.

1 Like

Oh wow, I missed that BTT had Find Image on Screen already. That's cool!

PS. It's OT for this thread, but since I brought up using KM for menus, I also just noticed "Floating Widgets: Coming Soon" in the config dropdown. Is that going to be a way to make menus? If so, awesome!

Glad to see all these new updates coming, Andreas. Thanks for all your hard work.

it’s for all sorts of things, but also menus :wink: More info soon!

It will also allow to transfer existing Tiuch Bar widgets to floating widgets easily

1 Like

Sounds amazing, can't wait!

Wow, some great posts in here. I know about Keyboard Maestro and I know some folks who use it with Finale. I didn't notice the Find Image feature in BTT before either, which seems pretty neat, and actually could be used conditionally using the last check box, I think? I wonder if I create two macros with the same trigger that both check for a certain pressed icon... I guess that would do it? I'll have to play with it!

wait for the next alpha, it will become very easy to do with that :slight_smile:

The latest alpha let's you select named triggers that get executed after the image has been found or has not been found: