I am currently experimenting with AutoHotkey and wanted to create a script that opens up the windows energy options. But since there is no path or anything I can use, I simply can't figure out how to do it. Anyone knows a solution or has done this before?
Asked
Active
Viewed 55 times
2 Answers
1
Or, to get there more directly, try:
Run, powercfg.cpl
But, depending on what you want to accomplish, there is a command line tool powercfg.exe
that may have a function you can exploit: https://msdn.microsoft.com/en-us/library/ff794903
powercfg [-l] [-q] [-x] [-changename] [-duplicatescheme] [-d] [-deletesetting] [-setactive] [-getactivescheme] [-setacvalueindex] [-setdcvalueindex] [-h] [-a] [-devicequery] [-deviceenablewake] [-devicedisablewake] [-import] [-export] [-lastwake] [-?] [-aliases] [-setsecuritydescriptor] [-getsecuritydescriptor][-requests][-requestsoverride][-energy][-waketimers]

PGilm
- 2,262
- 1
- 14
- 26
0
You want to simulate what you would do with the keyboard - that is the whole idea of AutoHotKey.
The following code uses Control-p to open the energy options:
^p::
KeyWait Control ; wait for the control key to be released
Send {LWin} ; send windows key
Send Power Options ; type in what you want to load
Sleep 300 ; waits for start menu to filter - adjust this number
Send {Enter} ; select power options
return

Tahir Hassan
- 5,715
- 6
- 45
- 65