VarName with double underscore half hidden in Prompt with List?

When working in KM Editor, I often need to enter three forms of variable names:
%Variable%Local__VN%
$KMVAR_Local__VN
"$KMVAR_Local__VN"
I want to make a KMM:
step1: copy varname by hand
step2: this KMM will process the variable names stored in the system clipboard, generate three var name forms, generate a list, and store it in the variable Local__VN_LIST.
step3: this KMM will display these three var name forms in the Prompt with List window. The user selects one of them, and this KMM will save the selected var name to the system clipboard for future paste.
You can use display text to check that the output of Local__VN_LIST is correct. But after that, I found that this list could not be displayed correctly in the Prompt with List window. I tried several different forms and all failed.
the KMM is:
image
then I tried:
image
all failed.
after some tests, I find what's wrong.
If a variable name string contains a double underscore, the double underscore and the part before it cannot be displayed normally.
the KMM is
kme - generate diff varname format (--sys-cb) v0.kmmacros (8.5 KB)
you can try the below:
image
the result is:


So is this a bug? or any setting can change this behavior?

BEST

No -- it's by design. Double-underscores are used show "friendly" values but return "unfriendly" data when using the "Prompt With List" action.

Honestly -- the best solution is to not use double-underscores in your variable names. Stick to singles instead.

2 Likes

It's not a bug, it's a feature:

If you want to display a “friendly” value as the default value, but store a different value (like a code), you can do this by using a code followed by two underscores (__ ) and then the value, for example:

Here's one way around it, though you'd have to do some work to set up the variable correctly before the prompt with list:

Insert variables by name.kmmacros (3.0 KB)

The list now returns 1, 2, or 3, and then the array feature is used to display that value from a regex'd version of the list.

-rob.

3 Likes

Just to add to this: There used to be an advantage of using double underscores like that - so Prompt for User Input would drop off the leading "Local__". But sometime after that was first implemented, Prompt for User Input changed to exclude "Local_" with one underscore.

2 Likes

Wish that was configurable, like allow triple underscores to display the 'friendly' name. I have a lot of double underscore values. To get around this, I convert my values to _._ and after the Prompt with List selection, I convert the _._ back to double underscores __

1 Like

Finally, I choose not to use Prompt with List :wink: