How to make variable return no value

I have a Prompt for User Input with a Popup Menu. I need one variable name to display ‘NONE’ and when selected will return no value. But when NONE is selected, the value becomes the variable name.

Here is the popup menu contents for %ThisVariable%: “__NONE|1__LOW-PRIORITY|2__HIGH-PRIORITY”

If “LOW_PRIORITY” is selected, %ThisVariable% becomes "1"
If “HIGH_PRIORITY” is selected, %ThisVariable% becomes "2"
If “NONE” is selected, %ThisVariable% is displayed as “%ThisVariable%”

I’m using the input to create folder names. If NONE is selected, the folder name should be “FolderName” but is showing as “FolderName%ThisValue%”.
If LOW_PRIORITY is selected the folder name is “FolderName1” as expected.

Hey Jimmy

If I've read correctly this is what you're wanting to do:

Prompt for User Input.kmmacros (2.9 KB)

You were also putting in a default value of 2 for HIGH_PRIORITY item, so I figured you were wanting to use a default of 1 for LOW_PRIORITY and made the change appropriately.

This version produces no value for NONE.

Best Regards,

The problem is that when a variable has no value, it is not considered to exist, and thus you cannot use the short form token %ThisVariable% in that case - that is just an invalid token.

As @ccstone pointed out but didn’t explicitly say, you need to use the full form version of the token:


Ah hah! Thanks for that info guys!! Just what I needed :grinning: