Stream Deck KM-Link plug-in parameters giving "Do Script" as %TriggerValue%

I have some Stream Deck buttons with PSC-Brushes, PSC-Layers, etc. in the KM-Link plug-in's parameter fields.

I need to handle these buttons differently in Keyboard Maestro, so I want to check if %TriggerValue% contains PSC. When I set the variable "Trigger" to text %TriggerValue%, I see that the button presses have a value of "Do Script" instead of "PSC-Brushes", "PSC-Layers", etc.

%TriggerValue% does contain the string PSC, as proved by a "show text in window" action I’ve inserted in an "if %TriggerValue% contains PSC" action. It appears to be changed to "Do Script" when I use this action:

What am I doing wrong?

I thought the text in a parameter field was supposed to enter KM as the %TriggerValue%.

As a good programming practice, the first thing I would do to take a step forward is change your variable to "LocalTrigger" instead of "Trigger" and delete the variable Trigger. You should never (in my opinion) need the value of the trigger outside your macro, and that's what Local variables were invented for. If you need to see the value of the Trigger (or any of the three Trigger tokens), display it while your macro is running using a brief notification window like this. Notice how I display all three token values here, which is what I do to make sure I'm getting the right token:

image

And as the above image suggests, there are three types of Trigger tokens, and it sound like you might just be confusing two of them when you wrote, "when I set Trigger to %TriggerValue%" while in your snapshot you are setting Trigger to %Trigger% instead. Those are different tokens, (see links below) which may explain why you are not getting "PSC".

I don't use KMLink, so I'll give you the benefit of the doubt that "Do Script" is the value that KMLink returns in one of the three tokens shown above, (that's usually how AppleScript triggers work, so that seems likely, since KMLink probably uses AppleScript to call your macro) but I suggest if you check the value of all three of the tokens above, you will find "PSC" in one of them. I think this may be the cause of your problem.

You didn't show your code for how you do your checking, so there's no way for me to know if that code is the problem, or if you are fetching the wrong token.

I don't use KMLink, so I'm not sure, but what I am sure about is that you are using %Trigger% not %TriggerValue% in your snapshot above.

Here's a link to one of the three tokens mentioned above. There are links to the other two tokens at the bottom of the page.

https://wiki.keyboardmaestro.com/token/TriggerValue

1 Like