-
I have VBScripts playing a sound that fire up when I: Log on, Lock, and Unlock my PC (via task scheduler). I'm on Win10. However, when I put my PC to sleep, it borks the 'lock' script, because the sound doesn't have time to play before the PC is suspended, so I get an error after I wake it up and unlock it. And I've found no way to delay the sleep command, other than firing it myself manually, when I want it to (at the press of a 'Sleep' button, but only after executing some VB code). So I figured this could work for me: I'd like to know the command used by OpenShell to put the PC to sleep (shown below), so I can use it in my script. Also I believe this may help you identify exactly what kind of sleep or suspend I want to fire off: Thank you for looking into this, and for maintaining such a great, and IMO indispensable utility <3 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
SetSuspendState API is used on standard machines: On machines with connected standby there is NtPowerInformation used: Though you can also invoke |
Beta Was this translation helpful? Give feedback.
SetSuspendState API is used on standard machines:
SetSuspendState(FALSE, FALSE, FALSE);
On machines with connected standby there is NtPowerInformation used:
NtPowerInformation(ScreenOff, NULL, 0, NULL, 0);
Though you can also invoke
Open-Shell
'ssleep
command directly via:"C:\Program Files\Open-Shell\StartMenu.exe" -cmd sleep