Jump to content

Recommended Posts

Hello, I couldn't find any reference in the forums to 'Connected Standby.' I am looking for a solution to creating a script to force my laptop to enter what Microsoft refers to as 'Connected Standby'.

Here is a vanilla ice-cream script that supports 'Standby' (S3) or Sleep after a set number of seconds

#RequireAdmin
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_UseX64=y
#AutoIt3Wrapper_Res_requestedExecutionLevel=requireAdministrator
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

#include <AutoItConstants.au3>
#include <MsgBoxConstants.au3>


$cd = 20
Do
    $cd = $cd - 1
    $i = MsgBox(262180, "", "Sleep in " & $cd & " seconds", 1)
    If $i = $IDNO Then ExitLoop;No Sleep
    If $i = $IDYES Then ExitLoop;Yes Sleep
Until $cd = 0

If $i = $IDTIMEOUT Or $i = $IDYES Then
    $s = Shutdown($SD_STANDBY)
    ;$s = Shutdown(BitOR($SD_FORCE,  $SD_REBOOT))
    ;$s = Shutdown(BitOR($SD_STANDBY,  $SD_FORCE))
    ConsoleWrite("$s = 1 => OK = " & $s & @CRLF)
EndIf

However this script doesn't put my new laptop into 'Connected Standby' the script Shutdown($SD_STANDBY) returns 0 i.e. failed.

Any help appreciated thanks.

Link to post
Share on other sites

the equivalent in autoit would be:

;AHK SendMessage, 0x112, 0xF170, 2,, Program Manager
;AHK SendMessage, Msg , wParam, lParam, Control, WinTitle, WinText, ExcludeTitle, ExcludeText, Timeout

#include <SendMessage.au3>

Local $hWnd = WinGetHandle("[CLASS:Progman]")
;or Local $hWnd = WinGetHandle("[TITLE:Program Manager]")
_SendMessage ($hWnd, 0x112, 0xF170, 2)

;or maybe??
_SendMessage ("[TITLE:Program Manager]", 0x112, 0xF170, 2)

 

Edited by Bilgus
Link to post
Share on other sites

Are you certain your computer can use that power mode? Open a command prompt and run the command "powercfg /a" and then look for the state Standby (S0 Low Power Idle) in the list. You'll see if it is even possible to use it. The laptop I'm running right now isn't capable of using that mode.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to post
Share on other sites
;AHK SendMessage, 0x112, 0xF170, 2,, Program Manager
;AHK SendMessage, Msg , wParam, lParam, Control, WinTitle, WinText, ExcludeTitle, ExcludeText, Timeout

#include <SendMessage.au3>

Local $hWnd = WinGetHandle("[CLASS:Progman]")
_SendMessage ($hWnd, 0x112, 0xF170, 2)

Thanks Bilgus & ModemJunki this worked well, now I am faced with finding a solution to get Scheduled Tasks to 'wake' from Connected Standby. Scheduled Tasks work well for Standby (S3) mode, however, I haven't yet found a solution to wake from Microsoft's 'Connected Standby'. Perhaps there is an AutoIt solution?

Probably best to Open a new Forum Topic

Link to post
Share on other sites
8 hours ago, BrewManNH said:

Are you certain your computer can use that power mode? Open a command prompt and run the command "powercfg /a" and then look for the state Standby (S0 Low Power Idle) in the list. You'll see if it is even possible to use it. The laptop I'm running right now isn't capable of using that mode.

Thanks for your reply. Seems to be supported, but nothing else is.

powercfg /a
The following sleep states are available on this system:
    Standby (S0 Low Power Idle) Network Disconnected

The following sleep states are not available on this system:
    Standby (S1)
        The system firmware does not support this standby state.
        This standby state is disabled when S0 low power idle is supported.

    Standby (S2)
        The system firmware does not support this standby state.
        This standby state is disabled when S0 low power idle is supported.

    Standby (S3)
        This standby state is disabled when S0 low power idle is supported.

    Hibernate
        Hibernation has not been enabled.

    Hybrid Sleep
        Standby (S3) is not available.
        Hibernation is not available.

    Fast Startup
        Hibernation is not available.

    Standby (S0 Low Power Idle) Network Connected
        Connectivity in standby is not supported.

 

In the registry it is possible to DISABLE the 'Connected Standby'

RegistryKey: HKLM>System>CurrentControlSet001>Control>Power>>CSEnabled=1 Default is set to 1, set it to 0 and reboot. And Standby (S3) becomes available, I did test it however upon waking from S3 the graphics becomes scrambled & or the OS freezes requiring a hard shutdown. According to ACER(OEM) this is not supported. Seems I am stuck with 'Connected Standby'

 

Link to post
Share on other sites

Try switching hibernation on (powercfg /hibernate on) and check again. This will allow the other settings that mention hibernation to be allowed (Hibernation, Fast Startup, and hybrid sleep).

All my code provided is Public Domain... but it may not work. ;) Use it, change it, break it, whatever you want.

Spoiler

My Humble Contributions:
Personal Function Documentation - A personal HelpFile for your functions
Acro.au3 UDF - Automating Acrobat Pro
ToDo Finder - Find #ToDo: lines in your scripts

Link to post
Share on other sites
On 8/23/2019 at 9:47 PM, VenusProject2 said:

now I am faced with finding a solution to get Scheduled Tasks to 'wake' from Connected Standby

Hmmm...

https://docs.microsoft.com/en-us/windows-hardware/design/device-experiences/modern-standby-wake-sources

Quick and dirty test - schedule a mouse move or keypress script?

; --------------------------------------------------
; Move mouse, then put it back back 
; --------------------------------------------------
Func _MoveMouse($PixX=1, $PixY=1,$Speed=5)
    Local $pos = MouseGetPos()
    MouseMove($pos[0] + $PixX, $pos[1] + $PixY, $Speed)
    MouseMove($pos[0], $pos[1], $Speed)
EndFunc   ;==> _MoveMouse

 

Always carry a towel.

Link to post
Share on other sites
8 hours ago, ModemJunki said:

Thanks, yes I had read that article yesterday, and sent feedback to request custom user defined sources for waking from modern standby, e.g. a Scheduled Task. I appreciate the mouse move idea, not bad at all. I will test it and get back to you. It seems that only approved Microsoft app store software is able to run when in Modern Standby, e.g Skype

Link to post
Share on other sites
  • 1 year later...
On 8/27/2019 at 3:32 AM, VenusProject2 said:

I will test it and get back to you. 

Hi, did you find a solution on that? I'm just sticking to Windows 10 1909 because 2004 and the following versions force modern standby and my  AutoIT automation software is no longer able to wake up the computer.

Regards, Achim

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...