StrokesPlus Forum
                       
StrokesPlus Forum
Home | Profile | Register | Active Topics
Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Lua Scripts
 General Action Scripts
 sleep/standby and hibernate command
 New Topic  Reply to Topic
 Printer Friendly
Author  Topic Next Topic  

Giusepppe

7 Posts

Posted - 05/13/2017 :  15:46:57  Show Profile  Reply with Quote
I am using very poor lines for these scripts. Do you have any better ones?

For sleep, i use this script;
acSendKeys("@")
acDelay(50)
acSendKeys("{TAB}{TAB}{TAB}~{DOWN}~")


For hibernate:

acSendKeys("{DELAY=100}@r shutdown -h{ENTER}")

NOTE: I'm using Windows8.1 with Modern UI.

Edited by - Giusepppe on 06/09/2017 21:33:43

Rob

USA
2514 Posts

Posted - 07/04/2017 :  11:13:39  Show Profile  Visit Rob's Homepage  Reply with Quote
Really, the only thing I can think of off the top of my head to use acRunProgram and leverage the command line options Windows has, as shown here:

https://superuser.com/questions/42124/how-can-i-put-the-computer-to-sleep-from-command-prompt-run-menu
Go to Top of Page

nober

12 Posts

Posted - 12/03/2018 :  11:18:09  Show Profile  Reply with Quote
Here's what I've come up with based on the link provided by Rob. Note that the first line of code changes the hibernation setting. In other words, if you want to do a manual hibernation after running the sleep script, you need to run the first line of other script, and vice versa, or go to control panel's power options.

To sleep:

acShellExecute('', 'powercfg', '-h off')
acShellExecute('', 'rundll32', 'Powrprof.dll,SetSuspendState Sleep')


To hibernate:

acShellExecute('', 'powercfg', '-h on')
acShellExecute('', 'rundll32', 'Powrprof.dll,SetSuspendState Sleep')
Go to Top of Page
   Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
StrokesPlus Forum © 2011-2018 Rob Yapchanyk Go To Top Of Page
Snitz Forums 2000