(IDLE/60) vs. (IDLE()/60) vs. CALCULATE(%TriggerValue%)

I have a macro which uses an Idle trigger. I can use IDLE/60 which appears to be the same as CALCULATE(%TriggerValue%) (both in units of minutes). However using (IDLE()/60) does not work. It seems to reset the idle time.

Bug? Feature? I cannot find a definition of IDLE in the KM manual, IDLE() doesn't work the way I expect, and CALCULATE(%TriggerValue%) works.

You should try
%CALCULATE%(IDLE()/60)%

You won’t find a definition of IDLE because it doesn’t exist in that form in KM. Here’s the definition for IDLE() in the KM wiki
https://wiki.keyboardmaestro.com/function/IDLE

Hey Guys,

“Idle” is found immediately when searching the Keyboard Maestro Wiki.

image

Note there is a link to both the Function and the Trigger.

The Idle function is also found quickly by using Search in the Keyboard Maestro Editor's Help Menu.

The Idle function is also found immediately by using Insert Function by Name (although the cursor in the editor must be in a field able to accept a function).

Searching the manual gets you there pretty quickly as well.

manual:Single Page Version [Keyboard Maestro Wiki]

-Chris

1 Like

Hi @ccstone - thanks for that. I assumed the OP knew about “Idle” as a trigger as that what he said he was using; but he couldn’t find “IDLE” defined anywhere so I pointed him to the function.

You highlighted:
IDLE - Seconds since last user input
which is neither a function nor a trigger and does not appear in the manual either.

Maybe it should!

1 Like

Of course I know the difference between “IDLE” and “IDLE()”, but thanks anyway.

The problem is now solved.

I ran three experiments:

Set Variable “SSIT1” To Calculation “CALCULATE(%TriggerValue%)”
Set Variable “SSIT2” To Calculation “CALCULATE(IDLE()/60)”
Set Variable “SSIT3” To Calculation “IDLE() / 60”

All worked.

So I’m now using the third one, but to be clear about the operator precedence, I’m using this calculation:
(IDLE() / 60) >= ScreensaverIdleTime

My earlier problem may have been an operator precedence problem.

CALCULATE is unnecessary.

Correct if you’re setting a variable to a calculation which you failed to say in your OP.