Schedule a task for when computer is idle


  1. Posts : 6
    Windows 7 Ultimate x64
       #1

    Schedule a task for when computer is idle


    Hello guys,

    I'm having difficulties scheduling a task for when computer is idle. What I want to do is run a task after the computer has been idle for five minutes. I've tried creating a scheduled task in different ways, which will do this, but to no avail.

    I go to Task scheduler to create a task:

    General Tab
    Give the task a name, put the check box to run with the highest priv., and configure it for Win 7.

    Triggers Tab
    New, Begin the task on idle, Repeat task for 15 minutes indefinitely, Enabled.

    Action Tab
    Start whatever program.

    Conditions Tab
    Start the task only if computer is idle for 5 minutes. Do not wait for idle.

    The settings I have not described stay default.

    Now from what I can gather from this is that every 15 minutes, the computer will run the task if the computer stays idle for 5 minutes. Say, I start the computer and leave it like that, then the task should run after 5 minutes. Then after 10 minutes, it will once again start checking to run the task.

    But this just does not work. If I leave the computer idle for even 7 minutes after startup, nothing happens. What am I doing wrong?
      My Computer


  2. Posts : 3,612
    Operating System : Windows 7 Home Premium Edition 6.01.7600 SP1 (x64)
       #2
      My Computer


  3. Posts : 328
    Windows 7
       #3

    This might help- MSDN: Task Idle Conditions
      My Computer


  4. Posts : 6
    Windows 7 Ultimate x64
    Thread Starter
       #4

    Thanks for the suggestions guys, but I got mighty tired of the task scheduler, and went for a quick fix.

    I downloaded a batch to exe converter, then converted the batch file to exe, renamed the .exe to .scr extension, and set the file as screensaver. Now the screen saver is absolutely awesome in every way possible, because it runs the task just as I want it to.

    Conclusion, Screen Saver is king, Task Scheduler is overrated (when it comes to running tasks after x minutes of idle time). But it works great for sending the computer to sleep at a specified time, and then waking it up again after a few hours.
      My Computer


  5. Posts : 9,582
    Windows 8.1 Pro RTM x64
       #5

    It is extremely difficult to get even the simplest of tasks (such as one to display a single word message) to work if the trigger condition is based on idle time. The reason for this is that the computer is very rarely (if at all) idle long enough in one go to satisfy the trigger condition. For example, you might have the task set to trigger when the system has been idle for 5 minutes. Let's suppose that the system is 100% idle for 4 mins 59 secs. At that point, there is brief system activity lasting just a few hundredths of a second. That is enough to cause the trigger condition not to be met, and so the task fails to run.
      My Computer


  6. Posts : 6
    Windows 7 Ultimate x64
    Thread Starter
       #6

    Yup, thats what I found too. At least with the screen saver, it usually does kick in. And if you want to have a regular screen saver, you can just have the batch call it up at the end (or at the start I presume) from c:\windows\system32\nameofscreensaver.scr.

    Btw, here is the batch file I've created (window will be minimized)

    Code:
    if not "%minimized%"=="" goto :minimized
    set minimized=true
    start /min cmd /C "%~dpnx0"
    goto :EOF
    :minimized
    TASKKILL /F /IM nameoftask.exe /FI "STATUS eq RUNNING"
    TASKKILL /F /IM nameoftask.exe /FI "STATUS eq RUNNING"
    TASKKILL /F /IM nameoftask.exe /FI "STATUS eq RUNNING"
    start iexplore
    If you want to completely hide the cmd window from showing, you can have this vbs call up the batch file

    Code:
    Const HIDDEN_WINDOW = 12
    strComputer = "."
    Set objWMIService = GetObject("winmgmts:" _
        & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
    Set objStartup = objWMIService.Get("Win32_ProcessStartup")
    Set objConfig = objStartup.SpawnInstance_
    objConfig.ShowWindow = HIDDEN_WINDOW
    Set objProcess = GetObject("winmgmts:root\cimv2:Win32_Process")
    errReturn = objProcess.Create("nameofbatchfile.bat", null, objConfig, intProcessID)
    Just remember to either put the batch file in c:\windows\system32, or edit the vbs to include the path where you want to call the batch file from. Obviously you can use this vbs to hide any process/application.
      My Computer


  7. Posts : 1
    windows 7 64 bit
       #7

    Hi, wonder if you might help me. i used your quick fix succesfully. except i cant get it to run invisibly. i keep
    getting the prompt splash. any help would be greatly appreciated. please as detailed as possible. im not as
    experienced as you :)
      My Computer


  8. Posts : 3
    Windows 7
       #8

    A year later . . .

    START /C <command>

    (or something involving a /C switch?)

    ==OR==

    Use nircmdc (free tool) along with a set window title, like this;

    From a batch, name the window that you want to hide:

    TITLE hidethis

    Then:

    nircmdc win hide ititle hidethis

    The latter may momentarily flash the window.

      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 22:53.
Find Us