Using variables for text snippets

I'm having the idea of populating invoices with which services are includes the total package.

For this I wanted to prompt the user for variables that are connected to the work and have me check the items included:

My problem is that I don't know how to have KM only input the item in the text string if it is checked in the previous box:

Is there a way to do this?

If I am understanding what you are trying to do, the below could be an approach.

Depending on whether the checkbox is checked or not sets the Variables to "1" or "0"

From that is is possible to test if each Variable is "1" (checked) and type certain text if it is and type nothing if it is not checked.

EXAMPLE Include Text in Typed String if Checked.kmmacros (7.3 KB)

Click to Show Image of Macro

As an aside - you are using "Global" Variables in your original Macro. That means their values will persist after the Macro has run. Better for something like this to use "Local" Variables which only exist for the Macro run. To make a Variable "Local" you just have to have the word "Local" at the beginning of its name. And in my example, the two underscores following the word "Local" mean that in the User Prompt only the text following Local__ is displayed. So, "Apple" is displayed rather than "LOCAL__Apple". When you run the Example Macro, you will see what I mean.

Also, the reason for using the Token %Space% rather than just typing a space is so it can be seen in the Macro Action to make it easier to edit.

3 Likes

@Zabobon thank you very much ‚Äď that is absolutely what I was looking for!