create sleep task, to force sleep over a program ?


  1. Posts : 113
    Windows 7 Home Pre 64bit
       #1

    create sleep task, to force sleep over a program ?


    Hello,

    I would like to know how to create a task in task scheduler , that'll force the computer into sleep over a running program.

    Basically, I have some software that runs in the background called 'WD anywhere backup' and when this software is running it prevents the computer from sleeping.
    I need the software to run, I cant disable it, because it backs up my computer to an external hard drive.

    But someone told me it might be possible to create a sleep task, but to override this program, or exclude it ?

    Many thanks in advance,

    Stuart
      My Computer


  2. Posts : 1,872
    Windows 10 Pro x64, Windows 8.1 Pro x64, Windows 7 Ultimate x64 SP1,
       #2

    I'm a little confused. If you put the computer to sleep, no programs will run, including the WD backup, unless it wakes the system up.

    Do you expect the WD backup to run during sleep?
      My Computer


  3. Posts : 113
    Windows 7 Home Pre 64bit
    Thread Starter
       #3

    pbcopter said:
    I'm a little confused. If you put the computer to sleep, no programs will run, including the WD backup, unless it wakes the system up.

    Do you expect the WD backup to run during sleep?

    Hello, sorry

    the auto sleep option in power saving options .... is set to sleep when computer is idle ... but although the computer is idle and no one is using it ... wd prevents the computer from sleeping automatically.

    I have tested by closing the wd program that runs in the area next to the clock, and the auto sleep feature works and closes after 30mins.

    But when the program is running, the auto sleep feature fails to work
      My Computer


  4. Posts : 2,467
    Windows 7 Ultimate x64
       #4

    There is a good reason for this. Once the computer goes to sleep, it will no longer work! All programs will stop executing, including your backups, which will NOT be made when sleeping (since the computer will be off).

    I don't think it's hard to make such a task, but doing so will disable the backup program automatically as a side-effect. The best thing you can do is to schedule the computer to sleep a few minutes after the backup schedule time, so it backups first, then sleeps.
      My Computer


  5. Posts : 113
    Windows 7 Home Pre 64bit
    Thread Starter
       #5

    Alejandro85 said:
    There is a good reason for this. Once the computer goes to sleep, it will no longer work! All programs will stop executing, including your backups, which will NOT be made when sleeping (since the computer will be off).

    I don't think it's hard to make such a task, but doing so will disable the backup program automatically as a side-effect. The best thing you can do is to schedule the computer to sleep a few minutes after the backup schedule time, so it backups first, then sleeps.

    Thankyou for quick reply,

    I am actually not wanting to the WD program to run whilst asleep. I want the "auto sleep feature" to close this WD program and for the computer to go to sleep.

    All im trying to get to work is the "auto sleep with idle" option when the computer is idle. But the WD program is preventing it from working as the WD program is continuously backing up in the background, it never stops.

    It has a continuous synchronisation feature, which means its constantly backing up your computer, every change to a file etc.

    When I close this program, the "sleep when idle" feature works ...

    So ive been told its possible to create a task in task scheduler to sleep the computer even though this program is preventing it from closing, so an override trigger to be exact.

    Many thanks

    Stuart
      My Computer


  6. Posts : 4,566
    Windows 10 Pro
       #6

    Go to type power options in the search. Click power options. Under your power plan you have set, click change plan settings. Change advanced power settings. Sleep-Allow wake timers-Choose disable. This will prevent any program from interfering with sleep as well as preventing programs from waking the pc.

    You could just click start-arrow next to shutdown -sleep when you want the pc to sleep instead of waiting for it to do that.
      My Computer


  7. Posts : 113
    Windows 7 Home Pre 64bit
    Thread Starter
       #7

    andrew129260 said:
    Go to type power options in the search. Click power options. Under your power plan you have set, click change plan settings. Change advanced power settings. Sleep-Allow wake timers-Choose disable. This will prevent any program from interfering with sleep as well as preventing programs from waking the pc.

    You could just click start-arrow next to shutdown -sleep when you want the pc to sleep instead of waiting for it to do that.

    Hey - I have tried this, but wd still wont let my computer sleep

    I tried again quiting the program, and it slept after 5mins (as a tester) ....

    I then re-enabled the wd program, and it then failed to sleep again - so frustrating lol
      My Computer


  8. Posts : 161
    Windows 7 Home Premium 64 bit
       #8

    If you're interested in downloading AutoHotkey, a free hotkey tool, you can use a script that will put your PC to sleep.

    I've been using AutoHotkey on my Desktop PC and Laptop PC's (both Win 7 x64) for about 3 years. It's a nice tool that I use to define keys and run various scripts.

    I have a script that should do what you're interested in:

    Code:
     
    Sleep 5000 ; comment: Not a "Sleep" standby command.  This is just a "wait" command within the script
    DllCall("PowrProf\SetSuspendState", "int", 0, "int", 0, "int", 0)
    Exit
    You can write a similar batch file for CMD but I found that it was easier for me to use the AutoHotkey DLLCALL since I'm using it anyway on both PC's.

    You can also define a hotkey for Sleep mode. The following line in my startup AutoHotkey script defines the key combination <win>s to put the PC into Sleep mode (Standby). I have Hibernation disabled on my Desktop PC.


    Code:
     
    #s::DllCall("PowrProf\SetSuspendState", "int", 0, "int", 0, "int", 0)
    If you decide to use AutoHotkey on your PC, you can then create a task in Task Scheduler to run the script.

    I have another script that I use to invoke Sleep unattended after a daily backup program completes. It runs with Task Scheduler at a time during the day when I'm rarely at the PC but if I am in an interactive session at that time, the script begins with a 4-count loop and plays one of the Windows media *.wav files, to let me know that the Sleep task has launched.

    Then the script will play one of my .wav music tunes for a couple of minutes, then fade out like a tune on a radio. If I want to remain on my PC, I can just run Process Explorer or Task Manager and delete the process to prevent the PC from going into Sleep mode.

    Here's my Sleep script:

    Code:
     
    SoundSet, 100
    Loop, 4
    {
    SoundPlay, C:\Windows\Media\Afternoon\Windows Notify.wav, wait
    }
    SoundSet, 60
    SoundPlay, C:\Users\Jeff\Documents\Music\WAV FILES\my_tune.wav
    Sleep 120000
    Loop, 70
    {
    SoundSet, -1
    Sleep 375
    }
    Sleep 2000
    DllCall("PowrProf\SetSuspendState", "int", 0, "int", 0, "int", 0)
    Sleep 5000        ; Keeps sound off for 5 sec after wakeup to mute residual wav output
    SoundSet, 100
    Exit
    Last edited by Scoop; 20 May 2014 at 00:48.
      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 03:16.
Find Us