New
#11
Also you can roll your own using AutoIt3 scripting language.
To go into Standby is trivial
Code:If Not Shutdown(32) Then MsgBox(0x1010,"Error","Standby Failed!") Exit
Power options... of course. Now I remember.
There is one setting in the advanced options for your active power plan, namely require password to be entered upon waking from sleep. I have that setting enabled.
I bet it's disabled for you...
Thanks for all the replies, now I'll explain my situation better:
I have 2 accounts on this pc. My specs are quite low. So if the other account needs all the power but I only clicked the shortcut "Standby" my account remains protected by password, yes, but remains logged in -> with running programs. Instead logging off and then click standby resolves the issue.
In other words I would like to unite the Log Off button with the Standby one. Gadgets aren't the solution as I've seen. Writing some commands and then make an .exe can be the solution, but I have no idea how to do it.
Could anyone help?
I think a difficulty may be if you log off, then the process that would ordinarily put you in Standby would stop running. The utility may have to run as a Windows Service.
I just looked at AutoHotKey Shutdown function. It's the same as AutoIt3 in that the code for logoff is 0. You add the codes together. Therefore there's no distinction between going into Standby and logging off first then doing Standby(which makes me think it's not possible using a normal app.)
I think the difference here is the terminology you're using, which can be ambiguous. From what I gather, you're looking to shut down all programs and log off (like you're clicking the log off button) of your account and then sleep, rather than just suspend your processes and lock the desktop (like you're clicking Win + L shortcut) and then sleep. If this is correct, you can create a Logoff shortcut at the below link.
Log Off Shortcut - Create
I'm not sure if this will work, but you can create the above "logoff" shortcut, create the "sleep" shortcut as pointed to earlier in the thread, then create a .bat file that calls both. For example, if you create both shortcuts on your desktop, you would simply create a file called logoffandsleep.bat with the following:
However, I could very well see a problem with only the first logoff command being run and not the sleep command as once you're logged out and that command is completed you're no longer running in an area that might allow you to perform the sleep action via a script. But, it's worth a shot.Code:rundll32 shell32.dll,ShellExec_RunDLL "C:\Users\YOURNAME\Desktop\Logoff.lnk" rundll32 shell32.dll,ShellExec_RunDLL "C:\Users\YOURNAME\Desktop\Sleep.lnk"
Thank you Fligi7 I will try later and report here!
My guess would be once you log off, then there's no user with shutdown privilege. But it's just a guess.
I suspected that too, however I gave a try.
- Created Sleep shortcut / created LogOff shortcut (with the tutorial on this site, also linked above).
- Created the .bat with that two lines.
When I click on it, my pc logs off and doesn't go in sleep mode. So only the first line is executed as we thought.
You could try on this forum:
Coding Snacks - DonationCoder.com
Please read the rules for Post New Requests Here subforum. The moderator on that forum is very good with AHK. He enjoys writing small utilities to order, which is the point of Coding Snacks. If you make clear the utility will likely need to be written as a service he can tell you if he can do it. There are "service wrapper" type programs that make it easy to configure things as a service but they might not be useful for this type of utility. The moderator is skwire.