enggniteshgarg Posted January 30, 2012 Posted January 30, 2012 Hi All, I am new in Auto Script. I am trying to get powrsetting from a mchine through script. I have diffrent model of laptop and desktop form which i just want to pull power settings. I tried pwercfg command line, but i don't know how to get curent user setting using this command and display in msgbox. does someone has any idea.Thanks in advance
BrewManNH Posted January 30, 2012 Posted January 30, 2012 powercfg -getactivescheme will return the currently active scheme in Vista and higher. In XP if you use powercfg -q it is listed in a table with the first entry being Name with the name of the scheme in use. 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
Moderators JLogan3o13 Posted January 30, 2012 Moderators Posted January 30, 2012 Hi, enggniteshgarg. It may also help us help you if you tell us a little bit more about what info you're trying to pull. As BrewMan mentioned, the powercfg command will pull most anything you want, but it can pull a LOT of data. Are you looking just for the active power scheme, like you would get with powercfg -L, or something more specific? "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
enggniteshgarg Posted January 31, 2012 Author Posted January 31, 2012 Thanks a lot for your answer. But I want to pull the information about Hibernet time, Power button action, Lid close action. I want to pull this value from machine using any command line or registry. Does someone has any idea.....?BrewMan i tried powercfg -getactivescheme but its not helpful for me...................Do you know some other optionThanks in advance..................
Moderators JLogan3o13 Posted January 31, 2012 Moderators Posted January 31, 2012 Hi, enggniteshgarg. These are all registry settings, but they are Binary settings so a bit harder to ascertain. The entries are located in HKCU\Control Panel\PowerCfg\GlobalPowerPolicy\Policies. For example, the option to "Ask me what to do" when the power button is pressed would be a value of:01,00,00,00,00,00,00,00,03,00,00,00,08,00,00,00,00,00,00,00,03,\ 00,00,00,08,00,00,00,02,00,00,00,03,00,00,00,00,00,00,00,02,00,00,00,03,00,\ 00,00,00,00,00,00,02,00,00,00,01,00,00,00,00,00,00,00,02,00,00,00,01,00,00,\ 00,00,00,00,00,01,00,00,00,03,00,00,00,02,00,00,00,04,00,00,c0,01,00,00,00,\ 02,00,00,00,01,00,00,00,0a,00,00,00,00,00,00,00,03,00,00,00,01,00,01,00,01,\ 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,02,00,00,00,\ 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,03,00,00,00,00,\ 00,16,00,00,00Whereas the option to shutdown when the power button is pressed would be:01,00,00,00,00,00,00,00,03,00,00,00,10,00,00,00,00,00,00,00,03,\ 00,00,00,10,00,00,00,02,00,00,00,03,00,00,00,00,00,00,00,02,00,00,00,03,00,\ 00,00,00,00,00,00,02,00,00,00,01,00,00,00,00,00,00,00,02,00,00,00,01,00,00,\ 00,00,00,00,00,01,00,00,00,03,00,00,00,02,00,00,00,04,00,00,c0,01,00,00,00,\ 02,00,00,00,01,00,00,00,0a,00,00,00,00,00,00,00,03,00,00,00,01,00,01,00,01,\ 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,02,00,00,00,\ 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,03,00,00,00,00,\ 00,16,00,00,00Notice the difference at character 38 on line 1, and character 10 on line 2.You might look at this (older) thread that talks about setting some of these properties, it may point you in the right direction. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
enggniteshgarg Posted February 1, 2012 Author Posted February 1, 2012 Thanks a lot JLogan3o13 . How i will pull all information like sleep time, Lid action, power button action and hibernet option using this registry key?
Moderators JLogan3o13 Posted February 1, 2012 Moderators Posted February 1, 2012 It is also in that same spot. This is what I would suggest: 1. Browse to this value in the registry and export it to a reg file. 2. Make the change you want manually. 3. Export the value again. 4. Use a tool such as WinMerge to show you exactly which bit has changed. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
Chimaera Posted November 21, 2012 Posted November 21, 2012 Can powercfg be used to set the Choose the sleep and display settings I want them for a laptop set to Never for all the options with it plugged in so no sleep no turn off display etc If Ive just helped you ... miracles do happen. Chimaera CopyRobo() * Hidden Admin Account Enabler * Software Location From Registry * Find Display Resolution * _ChangeServices()
BrewManNH Posted November 21, 2012 Posted November 21, 2012 (edited) This might do what you're looking for, it's from Windows 7 but I'm not sure if all those settings apply to all versions of Windows.-CHANGE, -X Modifies a setting value in the current power scheme. Usage: POWERCFG -X <SETTING> <VALUE> <SETTING> Specifies one of the following options: -monitor-timeout-ac <minutes> -monitor-timeout-dc <minutes> -disk-timeout-ac <minutes> -disk-timeout-dc <minutes> -standby-timeout-ac <minutes> -standby-timeout-dc <minutes> -hibernate-timeout-ac <minutes> -hibernate-timeout-dc <minutes> Example: POWERCFG -Change -monitor-timeout-ac 5 This would set the monitor idle timeout value to 5 minutes when on AC power. Edited November 21, 2012 by BrewManNH 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
Chimaera Posted November 21, 2012 Posted November 21, 2012 Yep similar to what i was working on RunWait("powercfg.exe -change -monitor-timeout-ac 10000 ", @SW_HIDE) RunWait("powercfg.exe -change -disk-timeout-ac minutes 10000 ", @SW_HIDE) RunWait("powercfg.exe -change -standby-timeout-ac minutes 10000 ", @SW_HIDE) But i have no idea to know whether it worked or not as i cant seem to find the settings to check lol If Ive just helped you ... miracles do happen. Chimaera CopyRobo() * Hidden Admin Account Enabler * Software Location From Registry * Find Display Resolution * _ChangeServices()
careca Posted November 21, 2012 Posted November 21, 2012 Example of a policy [HKEY_CURRENT_USERControl PanelPowerCfg] "CurrentPowerPolicy"="0" [HKEY_CURRENT_USERControl PanelPowerCfgGlobalPowerPolicy] "Policies"=hex:01,00,00,00,00,00,00,00,03,00,00,00,10,00,00,00,00,00,00,00,03, 00,00,00,10,00,00,00,02,00,00,00,01,00,00,00,00,00,00,00,02,00,00,00,01,00, 00,00,00,00,00,00,00,00,00,00,01,00,00,00,00,00,00,80,00,00,00,00,01,00,00, 00,00,00,00,80,01,00,00,00,04,00,00,00,00,00,00,00,04,00,00,c0,03,00,00,00, 04,00,00,00,01,00,00,00,08,00,00,00,00,00,00,00,03,00,00,00,03,00,01,00,04, 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,02,00,00,00, 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,03,00,00,00,00, 00,1f,6f,7e,58 [HKEY_CURRENT_USERControl PanelPowerCfgPowerPolicies0] "Name"="On" "Description"="This scheme is designed for maximum performance." "Policies"=hex:01,00,00,00,00,00,00,00,01,00,00,00,00,00,00,00,00,00,00,00,01, 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,32,32,02,02,04,00,00,00,04,00, 00,00,00,00,3a,77,2e,f2,07,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00, 00,00,00,64,64,64,64,92,7c Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe
careca Posted November 21, 2012 Posted November 21, 2012 (edited) Yep similar to what i was working on RunWait("powercfg.exe -change -monitor-timeout-ac 10000 ", @SW_HIDE) RunWait("powercfg.exe -change -disk-timeout-ac minutes 10000 ", @SW_HIDE) RunWait("powercfg.exe -change -standby-timeout-ac minutes 10000 ", @SW_HIDE) But i have no idea to know whether it worked or not as i cant seem to find the settings to check lol That doesn't work, but this does: ShellExecuteWait('powercfg.exe', '-change -monitor-timeout-ac 100000') ShellExecuteWait('powercfg.exe', '-change -disk-timeout-ac minutes 10000') ShellExecuteWait('powercfg.exe', '-change -standby-timeout-ac minutes 10000') EDIT: As a matter of fact only one setting worked as you can see from this pic. Edited November 21, 2012 by careca Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe
Chimaera Posted November 21, 2012 Posted November 21, 2012 (edited) So which one of these three work then? ShellExecuteWait('powercfg.exe', '-change -monitor-timeout-ac 10000') ShellExecuteWait('powercfg.exe', '-change -disk-timeout-ac minutes 10000') ShellExecuteWait('powercfg.exe', '-change -standby-timeout-ac minutes 10000') Edited November 21, 2012 by Chimaera If Ive just helped you ... miracles do happen. Chimaera CopyRobo() * Hidden Admin Account Enabler * Software Location From Registry * Find Display Resolution * _ChangeServices()
careca Posted November 21, 2012 Posted November 21, 2012 So which one of these three work then?-monitor-timeout-ac 10000') Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe
Chimaera Posted November 21, 2012 Posted November 21, 2012 (edited) These were what i was getting them from.http://technet.microsoft.com/en-us/library/cc748940%28v=ws.10%29.aspx- monitor-timeout-ac minutes- monitor-timeout-dc minutes- disk-timeout-ac minutes- disk-timeout-dc minutes- standby-timeout-ac minutes- standby-timeout-dc minutes- hibernate-timeout-ac minutes- hibernate-timeout-dc minutesI wonder if the minutes value is too large?500 would be 8 hrs which would be plenty Edited November 21, 2012 by Chimaera If Ive just helped you ... miracles do happen. Chimaera CopyRobo() * Hidden Admin Account Enabler * Software Location From Registry * Find Display Resolution * _ChangeServices()
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