Can i use a Variable within a Variable [Dynamic Variable Name] to paste a text?

My goal is to paste the contens of a certain variable. The variable-number is given by the user.

I succeeded in setting the variable using this:

First action:

I ask the user for to set the variable markernumber
Example: the users enters: "100"

Second action:

Then i store the contends of the current clipboard in the variable called markermarkernumber
As markernumber is "100" the contends of the clipboard will be stored in variable marker100

But i cannot recall in the same way as above:

When i recall _marker100_it does work.
But not when i recall marker%variable%markernumber%

What am i doing wrong, or is there another method to achieve this?

(gee, i have a hard time explaining this...)

You are close, but it is confusing. To use a KM Variable whose name is dynamically determined in the Macro, it requires two steps:

  1. Set a Variable to the variable token (computed name) you want to use:
    %%Variable%%myVar%Variable%myVarIndex%%%
    image
    .
  2. Use a KM Filter Action to process that Variable to "Process Tokens" to Get the Actual Data
    image

So now that variable can be used for output, like in your Insert Text by Pasting:
image

Here's an example Macro that demos this process.
Please feel free to ask any questions.


MACRO:   Use Dynamic Variable Names [Example]


#### DOWNLOAD:
<a class="attachment" href="/uploads/default/original/3X/7/4/741534a660c77d52cab91beb9162e22607b9f68b.kmmacros">Use Dynamic Variable Names [Example].kmmacros</a> (6.8 KB)
**Note: This Macro was uploaded in a DISABLED state. You must enable before it can be triggered.**

---



![image|591x1477](upload://36sWtAy6dr1oUMhGQcJAXPfhFBX.jpg)
3 Likes

Wow, thanks a lot!
After some fiddling around, i think i have managed! Just what i needed!

But it does bring up an second question. (that’s how it goes huh!)

I want to display a notification with a list of all the contends of variables that are all called
marker n
where n could be any character.

so:
marker1
marker2
marker3
marker100
markerSTART

etc

But i cannot use a wildcard * can i?

How would i do that?

For this use case, you may be better of using KM Dictionaries (KM Wiki).
See: