Tick Box Text Handling

Hi all, I hope you're all good.

New to KM and absolutely loving it but I have a very basic question if that's ok.

I'm using user input to create drop down and tick boxes but as the result I get from the tick box is either a 0 or 1, I'd love to be able to select a tick box then that triggers custom text. For instance, when I select the tick box marked Left I'd like it to out put L, for the tick Box Right I'd like it to output R etc

TickBox_CustomText.kmmacros (5.3 KB)
image

I hope that makes sense?

Then the macro collates the text and pastes into a program (I'm using Protools). I've attached the macro I'm currently working on. Any help would be greatly appreciated!

Dan

I'm not sure if that's possible, but I want to ask what you want the field to output if it's unchecked... an empty string? I think you're going to need to add a statement after the Prompt to convert the result to the string that you want.

Since the string you want is alphabetic, you'll probably need an IF statement and a Set Variable to String to get the value you want. However if the string you want is numeric, there's actually a sneaky trick you can use called the tertiary operator. but I think strings are the right choice for you.

Hi Sleepy, thanks for the speedy response.

Yes I'd like it to be empty if the box isn't ticked.

Ideally the outputted text string would look like this (obviously dependant on what was selected): L:C:Drop Out:3frames:3

I think I have a good solution, but at the moment on a little busy. I'll get back to you in 10 minutes.

Absolutely no problem Sleepy. Appreciate your help and no rush. Cheers

@Sleepy has the answer. You can put an If Then Action after your Prompt to set the Variable Left to L if the box is checked (1) or make Variable Left an empty string if the box is not Checked (0)

image

That's true, but I'm going to use the Append option of Set Variable to Text to fix this. Coming up soon. I'm giddy over my solution. Still working on it.

Let me show you some of the magic I've dreamed up here. This is just a screenshot showing you the technique I'm using (I'm not uploading all the code yet.) Notice that I've created a loop for some of the parameter names. Inside that loop, I use a trick (lots of percent marks) to append the contents of the variable with that name onto a variable called "TheResult". This is working. But it's not finished because I haven't added the code for the L/R parameters yet. And I noticed an ambiguity in the requirements. That is, if the Comments field is empty, do you want a pair of colons, or nothing at all. I may have to modify the code if I made the wrong assumption.

This is a pretty cool technique. I created it because I didn't like the idea of dozens of IF statements.

I'm still working on the code that deals with the L/R. Okay, I think I got that code working. Here's an image, I'll post the macro's code in a moment. Notice how I extract the first letter of the parameter and append it to the output if the value of the parameter is 1 (checked). Pretty cool.

Here's the macro.... I'm pretty sure I made some wrong assumptions about which variables are handled which way. Just move the variable name into the other textbox if I made the wrong assumption. If I've mishandled anything, I can fix the code. I just realized that we probably want to strip the final ":" from TheResult. That would be one more line of code.

Or you can completely ignore my code if you'd rather do it the old fashioned way.

New Method v1 Macro (v10.0.2)

New Method v1.kmmacros (10 KB)

Thank you both very much! Appreciate the effort. I will give it a try and see what results I get back. Have a good weekend. Dan.

It was my pleasure (coming up with this wild idea for processing arguments in the Prompt For User Input action.) I'll definitely use this technique in the future. Thanks for asking your question.