Stream Deck Plugin with Multuiple Folders or Profiles

I just set up a Stream Deck with the KM Plugin and it is terrific.

One question however...

Is it possible to program KM macros on subfolder pages or on alternate Profile pages? In either case, the Button ID is not unique so I get a secondary menu asking me to pick among multiple macros. Is there any way to resolve this so a Button ID is unique per subfolder/per Profile?

I’m on mobile, so I can’t verify anything, but one way I can think of is to create macro groups and profiles both based on applications. That way the macros will be unique per application and will pop up when the application is activated.

Another way is to not use the KM plugin for the stream deck. You can simple copy/paste the AppleScript to trigger a macro into a file, then create a StreamDeck action to “Open” that file. It’ll run the AppleScript and trigger your macro. This method feels more flexible to me, but less convenient to set up.

Give the buttons different virtual rows and columns and different Button IDs. The virtual rows and columns affect the trigger (which button triggers which macro). The different Button IDs affect which button is targets by the various Screen Deck actions.

2 Likes

Hi - could you clarify a bit more how that would work?

That would be great it it worked - I can assign a different Button ID but that seems to have no effect on a button press. The virtual row and virtual column are greyed out in the Config app; how can I change those?

Sure thing, but it’s past my bedtime right now. I’ll try to get back to you sometime tomorrow

1 Like

I see this issue was solved previously - it does work. Thanks

So the StreamDeck has a limited ability to run AppleScripts and shell scripts. From what I was able to tell, it looks at file extensions; any .sh extension will be run as a shell script and any .scpt extensions will be run as AppleScript. I've tried this with other types of scripts (for example .pl for Perl scripts) but haven't had much luck. It looks like shell scripts and AppleScript are special cases.

That having been said, the setup is pretty straightforward:

  1. Copy the AppleScript or Shell script generated by KeyboardMaestro to your clipboard.

  1. Open up a text editor and save the contents of your clipboard to a plain text file. In this example, I'm using SublimeText but TextEdit or any other text editor is fine as well.

  1. Create an Open action on your Stream Deck and point it at the file you just created.

And that should do it!

The reason I said this way is more flexible is because it separates away the physical structure of the StreamDeck from the trigger. This allows me to freely rearrange my stream deck without having to worry about going in and messing with my KM triggers.

@peternlewis related to this, I think it would be a nice enhancement to the Stream Deck plugin if instead of giving the button an identity and letting KM figure out what a particular button is supposed to do, you simply feed the Stream Deck a KM macro ID.

4 Likes

@gposcidonio That works perfectly... excellent solution. And I agree this is nice in allowing you to arrange the Stream Desk profiles without having to edit the row/column positions. Very nice - thanks.

You can also achieve this by making a KM trigger file. And "open' that (as if it is an application) from Stream Deck.
That is how i used to do this before KM9.
But, i love the ability to change the stream deck icon and text by KM.

1 Like

I was wondering about that because KM9 gives the option to trigger "by URL" using a kmtrigger. These URLs work in the browser, but they do not work as a "website" URL in Stream Deck nor do they work with an "Open" command in Stream Deck. Can these be used somehow in KM? How do I convert these KM trigger URLs to KM trigger files?

Does this help?

https://wiki.keyboardmaestro.com/Stream_Deck

I tried using those URLs directly in the Stream Deck configurator but was unsuccessful in any way I tried. Looks like it only respects HTTP urls.

Just select your macro and under the file menu is Export as Trigger File. I place mine in Application groups under my Trigger Files Folder. Easy to make quick Stream Deck Profiles using this method.

That works well - thanks

I have made a Streamdeck plugin to launch KM macros. I don't like all these trigger files or applescripts...

3 Likes

@corcules That works great - really nice - Thanks!

Thats very Nice @corcules!
Although the advantage of the KM Plugin is that it can change the icon and text from KM, where yours is fixed. And, a few macro's of mine use the Is Down or Key Release function.

Could you give some examples of how that may be helpful?

@rkaplan
To display the status of a function.

Imagine that the button is a toggle. John is home. John is out.

if variable John is "home" set variable John to "out" and make stream deck image icon out
else
set variable John to "home" and make stream deck image icon home

2 Likes