New user. Dumb question. How do I add "If" to an action.

Dan567

Member
I see lots of If statements in templates and forum. I can't figure out how to add one to my actions. How do I add one?
 

Dan567

Member
Action > Condition/Loops > If clause

Where is problem?
Thanks. With your help, I found the problem.
The Conditions/Loops wasn't listed for me.

I had turned on the Setting for Add Macro Wizard Mode and the first time I had created a macro was using "Home > Add Macro Wizard". I have been creating new macros since then, by clicking on the Macros button at the bottom and then clicking the plus sign at the lower right. I guess it has still been using Wizard Mode and you don't have Conditions/Loops in Wizard mode.

I turned off that option and clicked on Home > Add Macro. Problem solved.
Thanks
 

Dan567

Member
Try this:

If ...
vol = 100%
Else
vol = 50%
End if
Thanks. That makes more sense.

I just created another macro using constraints. I realize that in a situation like this one you couldn't use a constraint but in a simpler case where the logic would work either way is there an advantage to using constraints over "IF" statements?
 

Pseudocyclic

Well-known member
My understanding is that there is no difference. Generally I append constraints to single actions and use If clauses for multiple actions.
 

Dm114

Well-known member
My understanding is that there is no difference. Generally I append constraints to single actions and use If clauses for multiple actions.
So do I. It's faster and easier to read. 👍

Try this:

If ...
vol = 100%
Else
vol = 50%
End if
It's much better than 2 'If' statements!

I don't understand why many people use many single 'If' statements instead of a single 'If...elseif...elseif or else'. It's much more efficient and the other form (many single if statements) can lead to bad behaviour of the macro because even when the first single 'If' statement is true, all subsequent single 'If' statements will be executed. Then, some other conditions could also be true and execute some inappropriate actions...
 
Top