If Variable #1 Is Numerically Greater Than Variable #2

Hi All!

I am trying to create an If statement that displays a text if the variable "Short duration" is numerically greater than the variable "Long duration".

How am a using this If Variable Condition wrong:

image

The variable "Short duration" is currently set to 20 and "Long duration" set to 5, still the If statment's status as "currently false". Switching from 'is >' to 'is <' or 'is =' also doesn’t change it's status as false, so I am suspecting that it might not accept the form %Variable%Long duration% or something.

I have tried Googling, and looking in the Wiki, but I still do not understand what it is I do not understand here.

Kindest regards

You have it correct, except second field in the IF action is a calculation field, which is indicated by the C displayed when you place the cursor in the field:

https://wiki.keyboardmaestro.com/manual/Calculations#Variables

Variables

In numeric calculation fields, Variable Names are used without the % that are used in text token fields. Do not try to use tokens (like %Variable%MyVar%) in numeric calculation fields, just use MyVar by itself. The variable must contain a valid numeric value, or an expression that evaluates to a valid numeric value. So for example, if MyVar contains a text value of 2*3, then the calculation 4*MyVar will return 24.

I believe they are

C for calculation
V for variable
T for token (or is it text?)
etc.

This is documented somewhere, but I can't think what that indicator is called so I can't link it for you. Hopefully someone remembers what it's called and can tell us both.

Ah, of couse, this makes sense.
Thank you so much, now it works!

1 Like

It's briefly mentioned in the "Using Variables" section of the manual -- but blink and you'll miss it!

1 Like