Execute a Macro with parameter that contains a comma

I ran into trouble using an Execute a Macro action with a comma-separated parameter, where the sub-macro receives the parameter and uses the values of %TriggerValue[1]% and %TriggerValue[2]%

It works great, except when one of the comma-separated values itself contains a comma it is interpreted as a separator, which makes sense but botches everything up.

My solution was to use a pipe instead of a comma in the parameter, then split the %TriggerValue% into separate variables in the sub-macro using the Search using Regular Expression Action.

Is there a more direct way to "ignore" the comma as a separator within the built-in parameter structure?

In the KM wiki, the discussion of variables describes how to use something other than a comma to separate array elements thus:

How to Use Custom Array Delimiter

Place the custom delimiter after the closing bracket ] .

  • For Example: %Variable%myList1[i]:% , where the colon : is the delimiter used in the Variable Array.

  • Of course, the Variable Array, myList1 in this case, must use the same custom delimiter.

In this example, then, your parameter might look like

value, 1:value, 2

and you would access the values inside the macro as

%TriggerValue[1]:%

to give value, 1 and

%TriggerValue[2]:%

to give value, 2

I haven't tried it but it should work.

1 Like

Yep, that's perfect.

I don't think I would have made the connection here between variable array and token, so I would not have thought that parameters/TriggerValues could be used in this way. Thanks so much!

Glad it works!