KM macro to switch Stream Deck Profiles works but is slow

I didn't know that! Thanks! I'll check it out and consider it.

@Airy @para
thank you both. The iPad is a superb solution. I have an old ipad pro 2016, which I revived. 8x8=64 matrix with touch or apple pencil (instead of mechanical) buttons installed Stream Deck Mobile and ironically use the actual Stream Deck device to switch profiles on the iPad

1 Like

And don't forget this: if your iPad and Mac are both logged into the same Apple ID, and they are moved close together, you should be able to move your Mac mouse right onto your iPad. It works for me. The mouse doesn't look like a mouse pointer when it's over the iPad, it looks like a circle, and you can click on the Stream Deck buttons with your Mac's mouse!

1 Like

unfortunately, it does not work, I think because appleIds for icloud are different. But thank you for the suggestion.
Concerning both the ipad with Stream Deck app and Stream Deck app proper, have you found a way to batch copy or move the buttons ? When I rearrange profiles and have to copy paste multiple buttons, it gets tedious to do it one by one.
thank you

It depends what you mean. I have a way to move buttons around, and erase them, and add new ones, but my method has nothing to do with Stream Deck Profiles. Well, there has to be one profile and it contains nothing more than the Keyboard Maestro automation in each button slot. Then I have a single KM macro that responds to all 32 buttons, and passes the name of the button (eg, "R1C1") as a string to my button handler macro.

At one point I had a button programmed to swap the position of two buttons. So if you pressed the SWAP button, and followed it by two other buttons, the latter two buttons would swap positions. (Quite useful and amazing.) And I had another button which would randomize the positions of all the buttons. (Not so useful, but entertaining.) As for the other buttons, they just contained a single text string, and when you pressed that string, its corresponding variable name in KM would flip between 0 and 1. In addition, if it was 1, the button would be painted green, and for 0 it would be painted red. This is all I need for the moment. And then other code would be able to take the appropriate action.

  • For example, I have a button called "Sound" which is currently on my Stream Deck iPad, and it's currently green, and my macros can generate sound right now. But if I press this button with my finger, the button turns red, and (many of) my macros refrain from making sound.
  • For another example, I have another macro called "Running" which is green, and all my macros can run right now, but if I press the button, it turns red, and (many of) my macros will refrain from running.

Currently I've chosen for (most of) my buttons to be limited to two-state "toggles." I'm satisfied with that for now. Not everyone would be happy with this limitation. I'll add more features later.

Here's an example of how my code checks to see if a button is "green"...

1 Like

If you drag a button over another, they will automatically swap positions.

Imagine that you have a profile with a lot of empty buttons, and want to take 10 KBM macros and assign those macros to 10 buttons. Is there a quicker way to do this as opposed to configuring each button with a KM link action ? That is my biggest problem.

thank you

Hmm... I suppose you/we could create a macro that would drag the KM automation to all 32 button slots in about 10 seconds. But that would save you only a half minute of work (per profile), and that's not the worst aspect of the design.

The worst aspect, I think, is trying to coordinate the KM macros with the correct triggers for each button. If you move a button around on the Stream Deck, you have to independently tell KM that you have changed the meaning of some buttons, typically by changing the triggers for the macros. The main reason that's ridiculous is that the user of the Stream Deck may not even be the KM programmer, so the user now has to call the programmer and say, "Hey, I want to move my buttons around again. I can fix the Stream Deck utility, but I need you to change the KM macros." Or worse, the user may change the Stream Deck arrangement without notifying the KM programmer.

Using my replacement system, here's how I set up my Stream Deck buttons: (nothing more than this!)

...and then I call a utility macro I have called "Stream Deck Draw all Buttons."

Using Elgato's profile method, you have to have a separate KM macro for each button, and then if you swap two button positions in the Elgato app, you have to follow up by changing the triggers in the appropriate KM macros. That's tedious and unnecessary. So I created my own button handler.

A lot of the problems of the Stream Deck design could be mitigate if the KM actions for Stream Deck included reading the text of the button. As you can see here, there's a way to write text to a button but no way to read it back...

image

If there was a way to read it back, then you'd have some ability to detect if a button has changed position. Sure, the buttons would have to have unique names for this to work, but I would expect that to be the case 99.9% of the time anyway.

1 Like

No promises -- but SD button settings are "just" a JSON file. Edit that, quit and relaunch the Stream Deck app, and you've made your changes.

You'll find the file at

~l/Library/Application Support/com.elgato.StreamDeck/ProfilesV2/D44D93FB-73DD-4709-93EC-F1BBD9FA7EB2.sdProfile/Profiles/HLWR0RR9L565W1Q1KHE3344JKGZ/manifest.json

...although I'm guessing those "long codes" are unique to me and that the second one is for a particular profile.

The format for each key's entry in the Actions array -- in this example, for a button that uses "Open website" to trigger a macro by URL -- is (prettified):

"3,2":
{
   "ActionID":"48e37bcd-c83f-4eec-8b89-d0e05e9016ce",
   "LinkedTitle":true,
   "Name":"Website",
   "Settings":
   {
      "openInBrowser":true,
      "path":"kmtrigger://macro=E0F0105F-B4CA-452D-B48E-33E0C4A14ACF"
   },
   "State":0,
   "States":[{"Title":"paste"}],
   "UUID":"com.elgato.streamdeck.system.website"
}

First entry is the button index (row:column, starting at 0:0 for top-left). ActionID looks like an UUID, and KM can generate those. path is the KM URL trigger, Title is the button text, the rest looks to be boilerplate for that particular SD action.

You should be able to find similar structure for KMLink actions.

So you should be able to generate a bunch of button definitions programmatically, especially given KM's JSON-wrangling abilities. But, honestly, it's probably going to take longer to work out than it will ever take you to do it manually!

1 Like

My understanding is that the Kbm triggers follow

Sounds great. I will start working on it now. Thanks very much !

If you can do that, that's wonderful. But I don't see the name of the macro anywhere in the Stream Deck configuration.

1 Like

if you drag a button and drop over another, the buttons swap and so do the triggers

I haven’t had my iPad go to sleep. I do keep it plugged in because the stream deck app seems to drain the battery quickly.

1 Like

Yes, I made the same observation. I also noticed that sometimes the iPad loses the connection and I have to quit and restart the iPad Stream Deck app. Would you know if it's complicated to write an iOS shortcut to do so ?

It looks to me like the iOS Shortcuts app does not support the closing of any apps. Just launching.

1 Like

EDIT: I'm a dummy…I missed "iOS". Please ignore the below, it's macOS only. Sigh.

You can enable script support in Shortcuts' settings. Do that, and then you can make the apps quit via AppleScript:

tell application "Microsoft Word" to quit

Would that work for your shortcut?

-rob.

1 Like

You are certainly not a dummy. I was looking for AppleScript in the iPad shortcut actions and could not find it, so I am happy that I have an explanation. thanks very much for thinking about the problem.

you are right. I just read it on reddit in the shortcuts forum.

I've been telling people for 20 years that 20% of what I say is wrong, while you aren't wrong more than 2% of the time.

2 Likes

Hi, @Nige_S @griffman @Airy

this is what chatGPT comes up with when I ask to create an applescript to switch Stream Deck profiles.

Does not work. Does not recognize profile.

I am just curious (don't waste time with this): does the script make any sense?

thank you

set profileName to "Your_Profile_Name"

set json to "{\"profile\": \"" & profileName & "\"}"

do shell script "curl -X POST -d " & quoted form of json & " http://localhost:12345/profile"