Pause using a variable?

Hi Guys,

Still a “babe in the woods” with KM… but really loving it!

I’m using KM in music editing software and find that I often need to add Pause statements between many of the actions in the KM Macro.

I was wondering if there is a way to add a Pause %variable%Wait Time% type option so that instead of entering new wait times on all pauses, I could simply change the Pause variable.

Is there a way to do something like this or similar?

Thanks for any help.

Cheers,

Andrew K

1 Like

Yes: use the “Set variable to Calculation” or “Set variable to Text” action to define the variable, and insert its name into the text field of the “Pause” action. Don’t use the token %Variable%variableName%, just the name.

But note that in many case you’d better use the “Pause Until” action. It’s very versatile and has the advantage of always pausing for the shortest possible time.

2 Likes

Aha… I used % and was getting the invalid message. Ok… This should be fun :smile:

I’ll also get better familiarized with the “wait until” command… but I have a funny feeling it might not be as useful because I’m editing fields in an embedded scripting language in the app… so it’s not fully “aware” of it’s own status.

Thanks for the help!

Cheers,

Andrew K

You can set the “Pause Until” action to wait for you to press Return, or Tab, or whatever. Sounds like that in your case that could be even more useful. Just saying. :slight_smile:

1 Like

You can set the “Pause Until” action to wait for you to press Return, or
Tab, or whatever. Sounds like that in your case that could be even more
useful. Just saying.

Yeah… but I’m lazy and want to step away from the computer and let KM do all the work. These are not your typical KM scripts I’m doing… more like Batch processing :).

But I’ll definitely mess around with your recommendations… Great community here!

I am having trouble with the suggestion.

Have you tried to execute the action?
The test variable is invalid because it has not been set now.
You could run the macro or click the gear icon on set variable and choose
try. This will set the variable.

Hey Rivet,

No, you're not. You just think you are. :smile:

Ah, Jimmy just posted with the correct reason for your trouble.

Failing to initialize a variable and then being fooled by the invalid flag in the KM editor is a classic mistake I've made myself.

On another note – you're using a Set Variable to Calculation action without actually doing a calculation. If you're NOT going to do a calculation I recommend you use a Set Variable to Text action instead, because a day, a month, or a year from now you may look at your macro and wonder what you were thinking. Both actions will store the variable as text (NOT int or float).

As you can see in the attached macro both actions work fine, once the variables are initialized.

Generic-Test 01.kmmacros (2.6 KB)

There is another pitfall to the displayed result in the editor.

If the variable had a previous value; it will be shown. So if you are setting a variable again in your macro, and you forget to reinitialize it you'll see the previous value.

These little traps can really make you scratch your head, until you get used to them.

-Chris