VenusProject2 Posted August 22, 2019 Posted August 22, 2019 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.
spudw2k Posted August 22, 2019 Posted August 22, 2019 What is the value of @error after the Shutdown function call? VenusProject2 1 Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF
VenusProject2 Posted August 22, 2019 Author Posted August 22, 2019 Thanks the @error = 1300 Windows API GetLastError() a quick check reveals the following explanation: Quote ERROR_NOT_ALL_ASSIGNED 1300 (0x514) Not all privileges or groups referenced are assigned to the caller. UAC??
ModemJunki Posted August 22, 2019 Posted August 22, 2019 Hmmmm... it seems this can be done with AutoHotKey (see the last post in this link). https://social.technet.microsoft.com/Forums/windows/en-US/40cbc1e7-bdf5-4e4a-b007-161211099f99/putting-pc-into-sleep-mode-programmatically-windows-10?forum=win10itprosetup It therefore must be possible with AutoIT. 😓 VenusProject2 1 Always carry a towel.
Bilgus Posted August 23, 2019 Posted August 23, 2019 (edited) 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 August 23, 2019 by Bilgus VenusProject2 and Earthshine 1 1
ModemJunki Posted August 23, 2019 Posted August 23, 2019 @Bilgus, The first one seems to work on my system. Lets see what results @VenusProject2 gets ... Always carry a towel.
BrewManNH Posted August 23, 2019 Posted August 23, 2019 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 GudeHow 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
VenusProject2 Posted August 24, 2019 Author Posted August 24, 2019 ;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
VenusProject2 Posted August 24, 2019 Author Posted August 24, 2019 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 /aThe 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'
seadoggie01 Posted August 24, 2019 Posted August 24, 2019 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). VenusProject2 1 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 functionsAcro.au3 UDF - Automating Acrobat ProToDo Finder - Find #ToDo: lines in your scriptsUI-SimpleWrappers UDF - Use UI Automation more Simply-erKeePass UDF - Automate KeePass, a password managerInputBoxes - Simple Input boxes for various variable types
ModemJunki Posted August 26, 2019 Posted August 26, 2019 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 VenusProject2 1 Always carry a towel.
VenusProject2 Posted August 27, 2019 Author Posted August 27, 2019 8 hours ago, ModemJunki said: https://docs.microsoft.com/en-us/windows-hardware/design/device-experiences/modern-standby-wake-sources 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
AuScripter Posted January 10, 2021 Posted January 10, 2021 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now