How can I set a scheduled task to minimize open windows before sleep?

Page 2 of 2 FirstFirst 12

  1. Posts : 55
    Win7 / XP
    Thread Starter
       #11

    I'm on a different PC now but I'll look at the idle options - seems like I did look at that before.

    The other option I'm thinking is adding "sleep" into the script you gave me. That way I can pin the script/executable onto the taskbar and when my wife wants to put the pc to sleep, she can click on the executable instead of the windows icon.

    You don't have any idea as to how to modify the script so that it will minimize the windows and ALSO put the pc to sleep, do you? I'm going to do some googling as well.

    Thanks again for your help!
      My Computer


  2. Posts : 1,403
    Win 7 Ultimate 32bit
       #12

    I was also thinking that you can try creating a Task for Idle time that calls this file to run it instead of using Power Management.

    Also, this should work on PowerShell 2.0 on XP SP3, Vista and 7.
    But has only been tested on 7.

    Ok, I think, according to this...
    "How To Put the System into hibernation or Standby from Run menu"

    If hibernation is enabled, then the system will hibernate (this can be a better thing)
    If it is disabled, the system will sleep.
    That is, if I am reading right. Anyway....

    Let me know if this works for you or not.

    Download the MinWin&Suspend.exe file and run it,,, that's all you have to do.

    The following 2 files are extracted and run...

    Start.cmd
    Code:
    start /min powershell -executionpolicy remotesigned -file "%userprofile%\desktop\MinWin&Suspend.ps1"
    and then

    MinWin&Suspend.ps1
    Code:
    $shell = new-object -comobject shell.application
    $shell.minimizeall()
    Start-Sleep -s 5
    rundll32 powrprof.dll,SetSuspendState
    *****************************
    MD5: BED1E28250F6B2407EE9F3647541573B
    Last edited by Tepid; 23 Jul 2010 at 23:00.
      My Computer


  3. Posts : 55
    Win7 / XP
    Thread Starter
       #13

    Thanks Tepid. Haven't had a chance to try it but will let you know what happens. I really appreciate the help and suggestions!

    PS - right on with the tags on the bottom of your messages!
      My Computer


  4. Posts : 1
    Windows 7 Home Premium 64 bit
       #14

    [QUOTE=Tepid;845071]This should work....

    Code:
    Set shell = wscript.CreateObject("Shell.Application")
    Shell.MinimizeAll
    paste that to a text file and then name it whatever.vbs
    Create a task that calls the file,, should work.

    Let us know if not, it may need some refining on the commands in the Task itself, to call the vbs file properly. I have not used it in 7, but it works when double clicked

    ----------

    I used this VBS script to create a task scheduled at a specific time. I need to tear myself away from my computer to go to bed so I set it up to minimized all windows every 1 minute - the triggers repeat every five minutes for an hour, but I set up five triggers at 9:40, 9:41, 9:42 etc.

    I really appreciate the script - I need something that is annoying but that I can still work through for a few minutes if I have to finish up.
      My Computer


  5. Posts : 83
    win7 64bit Ult. using: XP Mode, in English or Español, SUA, Bitlocker
       #15

    Possibly alternate suggestion:

    As a safeguard, disable the sleep button in the startup menu. Tutorial: Sleep : Disable in Shut Down Menu

    Or possibly a better way to disable the sleep button is to go to the Power Options screen | Change Plan Settings | Change Advanced Power Settings (lower left). There will be a little dialog that pops up. Scroll down to 'Power Buttons and lid', and adjust the 'Sleep Button Action' accordingly - Do Nothing.

    The computer does not have to sleep immediately before she leaves it, I'm thinking(??) For example, maybe you can have the task scheduler start a daily task- to run a script posted above in this thread at a certain time.... possibly at 12:00 or whatever. The script will minimize all windows (show desktop), then it puts the computer to sleep.

    ETA: Kudos to the above posters who suggest commands to put the computer to sleep. Apparently it's not that easy of a task. Something you would think is simple at first glance, isn't.

    Note: Then if you have time, try to find a command that will stop all network traffic before it puts the computer to sleep. These days, they have USBs that are available for charging even when the computer is sleeping. This means that to me that the computer is NOT sleeping like it used to... It's still 'on' in a sense. You get the picture.
      My Computer


  6. Posts : 83
    win7 64bit Ult. using: XP Mode, in English or Español, SUA, Bitlocker
       #16

    You may need two jobs in Task Scheduler - one after the other. Here is how to make two little programs. One to show desktop, and the other to put the computer into sleep mode:
    -------------

    From http://www.wikihow.com/Make-the-Show...Launch-Toolbar

    Show the Desktop, type these file lines into a somename.scf file:

    [Shell]
    Command=2IconFile=explorer.
    exe,3
    [Taskbar]
    Command=ToggleDesktop

    ..that will show the desktop / minimize all windows.

    ==========================================

    From: http://answers.microsoft.com/en-us/w...a-290b3dea1ffb

    Then to sleep, use this in a .bat file. Follow the next three steps to create this.

    1) Make a somename.bat file.

    2) paste the next three lines into it... save

    Echo On
    Rundll32.exe Powrprof.dll,SetSuspendState Sleep
    Exit

    3) run it.

    Need to add the Sleep argument/word at the end of the line above.

    Some users say that it puts their computer into hibernate mode, not sleep. May have to disable Hibernation. Worked for me though.

    Hope this helps.
    Last edited by dperecky; 16 Dec 2013 at 00:54.
      My Computer


 
Page 2 of 2 FirstFirst 12

  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 01:41.
Find Us