Choose an action based on pasted text?

I have a bunch of macros that I'm triggering by hitting buttons on my Stream Deck. One action in each of these macros opens a file, and the only difference between each of these macros is which file is being opened. As a result, I have duplicate macros, each with a different file specified.

The KMLink plugin for Stream Deck can pass on a parameter, which can be pasted using Insert Text β€œ%TriggerValue%” by Typing. Would it be possible to reduce this to one master macro that uses the parameter passed on from KMLink to choose from a range of files to open? I am imagining a group of multiple Open File actions, one of which will open if it receives its expected parameter text.

This would be pretty great to figure out, so many thanks in advance for any help you might be able to offer.

Can you share what you got so far.

You can use a Switch action, setting a variable to N value, and them comparing the value against a pre-defined list

Hi @noisneil - there was a discussion I contributed to about using the parameter. Have a look at my example macro that makes use of it to perform different actions depending on what the parameter is (and depending on the SD button that was pressed).

If you need more info, just ask!

Thankyou both for your help!

Here's what I'm dealing with. With the exception of the two macros I've darkened out, these all load UAD Console presets (an audio routing app). As you can see from the highlighted example, each of them opens a different preset file.

I've been using the KMLink parameter box with great success for simple text pasting, but converting that into choosing a file to open had me scratching my head.

The good news is the Switch idea works great! I set the clipboard to variable %TriggerValue% and then use the Switch/Case action to create the list. Perfect!!!!

Thankyou so much!

2 Likes

Yeah, no need to have all those macros when one will do. You set up a popup list in which the value is the destination file and the displayed option is the "contains" string you used in your macro. Then just one Open action will act on the value passed to it.

For an example of this (which lets you write a simple text file to make the associations for applications, file and folders), see A Few Favorites Macro. Or, you know, just use that :wink:.

Hey @noisneil - good work!

I'm a bit slow on the uptake today. Are you saying there's a more efficient way to do it than what I've done? Which action do I use to do the same thing but with one Open action instead of multiple for each file?

  • Prompt with List using ~/Documents/Universale/Audio/etc/filname__File I Want as the list format (so you see File I Want but get the filename path stored in the variable the action returns.

  • Open as you have it but with the variable used in the above.

These are the last two actions in the macro I referred you to.

I apologise for my lack of experience, but I don't understand your instructions or indeed what your suggestion does. However, I did come up with this:

Simply putting the entire file path in the Stream Deck parameter box. Why didn't I think of that before?! Is there's some advantage to your method over this?

That’s a very neat approach.

1 Like

Sorry, I thought you were trying to get rid of a conflict palette whose only merit was delivering a different filename to the same basic macro.