Posts: 48
Threads: 18
Joined: May 2011
Is there a way to run a macro on a schedule as soon as the PC is not in use?
For example, I may be working on the computer typing and a scheduled task may run (including login if no-one is using the computer), but I want it to wait until I'm not using it (ie the screen saver comes on, or no mouse or key entry for X minutes, etc) so it doesn't interrupt what I am doing.
Posts: 12,090
Threads: 142
Joined: Dec 2002
Did you try to use Task Scheduler? It has an option "When idle". You can create scheduled tasks from QM macro Properties dialog.
On my Windows 7 it does not work.
Other option - run a function that repeatedly calls WaitIdle. When WaitIdle returns, launches the macro using mac.
Function
idle_scheduler
rep
,WaitIdle 60 ;;1 minute
,mac "Macro1993"
Posts: 48
Threads: 18
Joined: May 2011
I'm running Win7 as well. When I tested, it didn't work as expected. The task scheduler help says the following about the idle condition:
"The Task Scheduler service will check if the computer is in an idle state every 15 minutes. A computer is considered to be in an idle state when a screen saver is running. If a screen saver is not running, then the computer is considered to be in an idle state if there is 0% CPU usage and 0% disk input or output for 90% of the past fifteen minutes and if there is no keyboard or mouse input during this period of time. Once the Task Scheduler service detects that the computer is in an idle state, the service only waits for user input to mark the end of the idle state."
So basically, Win7 allows you to set a condition to start the task if idle for 1 minute, but only checks every 15 minutes to see if it is idle.
I ended up using WaitIdle without using rep.
Thank you!