Get/Set Value of Variable by Name - Macro Examples

Because I've struggled with this previously, including going so far as to write an (unnecessary) plugin, I thought I'd share these examples.

Set Value of Variable by Name


Set Value of Variable by Name - Macro Example.kmmacros (2.6 KB)

Get Value of Variable by Name


Get Value of Variable by Name - Macro Example.kmmacros (2.5 KB)

4 Likes

###Here's another example, used by a sub-macro that is passed a Variable Name as a Parameter (TriggerValue):

This uses the Filter Variable with Value of Named Variable that @peternlewis just showed us in another thread.

It is used in this macro:

[KM] DELETE List of KM Variables [SUB-MACRO]

2 Likes

Hey Dan,

Okay, lets throw in an extra layer of abstraction.

-Chris


Get Value of Variable by Name - Macro Example.kmmacros (3.0 KB)

2 Likes

You don't really have a use for this, do you?

Hey Dan,

I have used it a few times, but I don't think I'll need to now that Filter with Value of Named Variable exists.

Probably.  :smile:

-Chris

2 Likes

Yep, that's a cool Action/Filter.

I finally had a need for your example. Thanks!!

1 Like