Most Efficient Way to Not Include an Empty Variable

Dear all,

What is the most efficient way to not include an empty variable?

For example, I got a macro that always prompts for an author variable- like what's the author? This variable then gets always included in a "set variable to text" action as %author% . If I cancel the prompt, the variable literally show's up as "%author%" as opposed to, e.g., "Ghandi". To circumvent the "%author%" case when the prompt action get's canceled, I have set up an "if-else" action with a "The text is" condition that checks for the %PromptButton% variable. This works great. However, it get's quite messy if you have several such prompts, e.g. author + year + abstract.

So, I was wondering if there might be a more elegant solution to exclude variables that remain empty after a prompt is cancelled (or just left empty)?

Instead of quoting your Variable as %Author% quote it as %Variable%Author%

This is good practice anyway because it allows you to quickly see what are Variables and what are Tokens.

Click to show GIF

Screen Recording 2022-02-13 at 13.16.30-Animated GIFF 640 12fps

1 Like

Awesome! Thanks a lot! Exactly what I was hoping for!

1 Like