KM macro to switch Stream Deck Profiles works but is slow

yes, you are right. In that vein, I created a button template profile consisting only of empty buttons with different background design/colors and text font/color. When I add a button in any profile, I just copy from the button template profile to the profile of interest.

1 Like

If I'm understanding correctly, you've developed a way to use a Keyboard Maestro dictionary, with your "button handler," that lets you move SD buttons without having to change the KM trigger's Device Key row and column???

I've been using the UI hack instead of the "dummy app" method because I didn't want to be constantly updating the device key as my button system evolves.

If I'm correct that your method does it require updating the device key, would you be willing to share examples of add dictionary and your button handler?

Thanks,
Russell

That is correct. I rewrite my code from time to time and my current button handler does not support the moving of buttons, all buttons currently are currently displayed in alphabetical order. That design actually works for me, but I realize that won't work for everyone. Also, my current code simply changes the contents of the variable whose name is displayed on the Stream Deck button. Again, that won't work for everyone. Some people will want the button to trigger a macro, and I could certainly and easily add that feature.

I scrolled back to this thread to see what you are referring to here, and I can't determine what you are referring to.

In a post above, I did share some details of my code. I showed what my dictionary contained, and I explained how my code interpreted that data.

You can see the dictionary above, including the key and the data. If the data starts with the word "Green," then the button is drawn in green and the variable whose name is the key is set to 1. If the data starts with the word "Red," then the button is drawn in red and the variables whose name is the key is set to 0. This doesn't seem like a lot, but it really helps me. And then I have a single macro with 32 USB triggers that starts like this:

and contains these actions after the 32 triggers:

What this does is allows me to stop having a separate macro for each button. This is all it takes to give me the power of indirection. By doing this, I can have a single macro that can handle all buttons. Yes, I call it a "button handler." Here is the first action in the button handler:

image

This extracts the button numbers. The actions that put data into the dictionary are easy enough, but I won't upload them today. Here's the last action for you to ponder, which is the code that actually sets the colour of the buttons.

image

When I upload my entire set of macros, I will do it in a new thread.

Thanks for the additional info. This is quite a bit beyond my level of expertise, but you've given me a starting point for further study.

I downloaded DoNothingApp.zip and duplicated DoNothingApp.app. (renaming the duplicate to PS-Adjustment Layers.app). Stream Deck will let me specify DoNothingApp.app, but when I select PS-Adjustment Layers.app, it reverts to DoNothingApp.app.

Any idea why it's not accepting a renamed copy of DoNothingApp.app?

I'm not sure I understand what you're saying—what do you mean it reverts to? Screenshot?

-rob.

1 Like

Thanks, Rob.

In the Stream Deck preferences profiles tab, I select a profile and click the "Application" pull-down menu. I scroll down to Other... , then navigate to and "Open" the dummy app I created by duplicating your DoNothingApp.app and giving it the name, "PS-Adjustment Layers.app". But instead of listing my dummy app as the profile's application, it lists DoNothingApp.app, ignoring what I’ve just set as the application.

Why would the SD app accept some dummy AppleScript apps and not others?

Thanks for the clarification. I wonder if Stream Deck uses bundle identifiers, which would be the same for a duplicated app. Try this instead: Right click on dummy app and open it in Script Editor. Use Save As to save it as a new application name (Dummy App 2), then try Stream Deck again.

I don't do anything like this with my SD, so it's tough to give much more specific guidance :).

-rob.

That worked!

I also had success opening your original DoNothingApp.app and doing a "Save as..." from it.

Think it’s the bundle IDs?

Thanks,
Russell

Yep, it sure seems like they use bundle IDs. Either method will work—as long as you Save As from AppleScript, it'll get a new ID.

-rob.

I found this comment on the original post for the dummy app hack:

I found I needed separate apps with unique names/bundle IDs for the Stream Deck to recognise them as distinct per profile, so creating unique apps on the fly seemed easier.

Makes sense! Glad you got it sorted.

-rob.

In my experience, the SD app displays blank apps by their original name, but it makes no difference when it comes to the profile switch hack working.