Q: One Macro With Several TriggerValues; or Keep as Separate Macros?

Is one better than the other?

Have some macros that have a lot of duplicated actions in them, ie, Macro A has 5 actions, and Macro B also has 5 actions, and both share 4 out of those 5 actions.
So, would like to simplify those KM macros that share a lot of the same actions by:

  • Merging them as possible
  • Use TriggerValues to use actions depending on passed value(s).

But would like to know: Is there any advantage of having them as separate macros (as they currently are), versus
is there any advantage of having them as part of the same macro.

In my case, as an example, I have a macro that scrolls the view of the image I am currently editing in Adobe Lightroom. I could have had 4 macros (one each for scrolling up, down, left and right) each consisting of 15 actions. In each of those macros only 1 action is unique to that macro. So that's 60 actions spread over 4 macros with 56 actions the same and 4 different.

Instead, I chose to implement it as a single macro consisting of 30 actions the "main" one being a Switch action that branches depending on the %TriggerValue% that's passed to the macro in the first place.

Why did I chose one over the other? The answer is clarity and ease of maintenance. For example - the %TriggerValue% is generated by a press of a button on my Stream Deck. If I wanted to change the triggers from say "Up" to "u", "Down" to "d" and so on, I know exactly where In KM I need to go to support those changes - it's a single macro and not 4 different ones.

I can imagine times when you might have a macro that, when it's triggered, will then go on to execute one of a number of possible sub macros depending on the %TriggerValue%. I have a couple like that - the "worst" one being a single macro that potentially executes one of 25 different sub macros depending on which web page is currently showing in my browser. This implementation makes it easy to add the triggering of extra sub macros as and when I need to add the processing of additional web pages. By the way those 25 sub macros have little in common even though they all do something similar (update clients' websites via admin functions). Why did I choose to do it that way? In actual fact I just wanted to be able to hit the same hot key on whichever web page I'm on without having then to see a conflict palette; in effect, the single macro that the hot key triggers looks at what web page I'm on (via the %TriggerValue%) and then uses a dictionary look-up to decide which sub macro to run.

So I can see great benefits to doing things this way.

As for your case: if there is the possibility of adding more macros into the mix in the future, I would probably consider merging them somehow. But - if you're only ever going to have those 2 macros and you're happy having separate hot key triggers or a conflict palette to run them then leave them as they are.

That's my tuppence worth for you :smiley:


Greatly appreciated your two pence, Lord Tiffle :slight_smile:

Yes, maintenance is also one of the main benefits I'd see if I merge macros, I guess it'd also make it easier to debug.
The only part that makes me doubt is that a merged macro will be larger, will have more actions and switches and whatnot (which seems to be the only con), at the expense of a leaner KM with fewer macros.

1 Like

Yes - I forgot to mention that! Good point.

1 Like

Update 1:
Merged four macros into one, working great :smiley:

Have other two macros that called two of those previous macros (using an Execute Macro), still not sure how to proceed.
Will try merging those two as well and use TriggerValue for these as well.

1 Like

Execute Macro action lets you specify a parameter which then becomes the %TriggerValue% for the sub macro.


Great point – this gives the ability to create a “macro alias” with unique characteristics.

(Explanation added for posterity.)


1 Like

So, if I surmise properly:

If I enter the up arrow symbol in the "With Parameter" input field,
this is what will get transferred to the TriggerValue?
Used in a Macro that triggers using keyboard arrows, and want to pass the Up Arrow key as the parameter

Edit: Clarity

1 Like

Good question! I’ve only ever passed text-type stuff via the parameter, so I don’t know.

All right, just tried the above and it worked exceedingly well.

At long last, understood what TriggerValue & "With Parameter" are for.


Thanks for teaching me something new today, @hello !


All of the positive points mentioned here are well taken on the use of multiple hot-key triggers for a single macro, but may I add a slight caveat? I often find myself wondering if I've already assigned a particular hot-key trigger to some macro because I'm thinking of using that trigger for a new macro, and so I select All Macros, sort by trigger, and see if it's in the list. But if a macro has multiple hot-key triggers, only the first appears. Just something to keep in mind (and if there's another way to determine if a hot-key trigger is already in use – apart from trying it and watching for the conflict palette – I'm sure someone will clue me in! :slightly_smiling_face:)

good observation @SLWorona, just noticed this myself and was doing something similar to what ccstone commented:

You can create a spartan macro that consists of just two elements:

  • One keystroke trigger
  • One action (Execute Macro With Parameters)

That way you benefit of

  • Keeping all the Hot-keys visible when using Sort by > Name, and
  • Keeping all the actions in one single macro, executing parts of the macro depending on the passed parameter(s).

You are running up against the common dilemma for software authors that we call “Don’t Repeat Yourself”.

Wikipedia has some discussion around the pros and cons of extracting out a reusable abstraction in cases like this.

In my opinion, splitting things out for reuse is a great idea here!

Which approach to take is a design issue:

  1. If all of the macros/workflows have a lot in common,
    then it is probably best to have ONE macro with a Switch or Case action to handle the unique Actions for each use case
    • I use this approach with my "Clip Email to Evernote" macro, which has custom handling based on the subject and/or sender.
  2. If all of the macros/workflows involve mostly different actions,
    then it is probably best to have separate macros that share a common hot key, and make use of the "Conflict" palette.

A post was split to a new topic: How Do I use StreamDeck Buttons to Trigger One Macro With Different Parameters?