Variables scope and type?

My macro here->


My goal is:
Call the macro with keyboard -> check if current time earlier than 11pm -> if so, count down for 2 hours and prompt to put my Mac to sleep; otherwise count down for 4 hours and do so.

That's because I'm suffering dry eye for now. And I'd like to constrain the time I spend with my Mac.

There seem to be problems with variable 'ct', could you tell me why?

Haven't had a chance to study your macro, but to answer your question:

Variables scope and type?
see Variables -- scope and availability

Thanks for your help.

It turns out that the hint indicating the current value of variable confused me. I have to try the action first to get the right value!

1 Like

I don't see any immediate problem with the macro.

The variable ct currently has a value of "" (empty), as can be seen here:

which is why the Pause action shows it as invalid. This is simply because your macro has not run yet - the Pause action can only see what the current value of the variables are not when they might be if the macro had run.