Jump to content

Power Options


Dobs78
 Share

Recommended Posts

I've spent the better part of an hour and a half searching for the forums for what I'm trying to do.

Scenario: My company has several model laptops, each with their own power management utility. I've gotten to the point where I can identify the model laptop in use and changing the power management program to windows power management, not a problem with that. However, ran into a bit of a brickwall, and it's probably something obvious and I'm thinking it's more difficult than it is. On the Power Options Properties window, there's a section for "settings for $blah power scheme. Now, the this section is only one control and I've been trying to find a way to loop through to see how many dropdowns are listed within the control and am either having a total brain fart or my search skills just suck today. But what I'm wanting to do is find the number of dropdowns, so I know how many times I have to do Tab, !n to set all power options to Never. This script also needs to be able to run on both desktops and laptops, and dependent of the manufacturer, there could be 3-8 dropdowns.

Any help is appreciated, a link or point me to the function I need to use and I can take it from there. Thanks in advance.

Link to comment
Share on other sites

IMO - your approach to changing the Power Options is tedious and easy to encounter errors.

The registry approach is cleaner, shorter and easy to implement.

Have a look at the registry keys located under:

HKEY_CURRENT_USER\Control Panel\PowerCfg

Easy enough to figure what's in there and how to do it this way - good luck.

SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Link to comment
Share on other sites

I've spent the better part of an hour and a half searching for the forums for what I'm trying to do.

Scenario: My company has several model laptops, each with their own power management utility. I've gotten to the point where I can identify the model laptop in use and changing the power management program to windows power management, not a problem with that. However, ran into a bit of a brickwall, and it's probably something obvious and I'm thinking it's more difficult than it is. On the Power Options Properties window, there's a section for "settings for $blah power scheme. Now, the this section is only one control and I've been trying to find a way to loop through to see how many dropdowns are listed within the control and am either having a total brain fart or my search skills just suck today. But what I'm wanting to do is find the number of dropdowns, so I know how many times I have to do Tab, !n to set all power options to Never. This script also needs to be able to run on both desktops and laptops, and dependent of the manufacturer, there could be 3-8 dropdowns.

Any help is appreciated, a link or point me to the function I need to use and I can take it from there. Thanks in advance.

I don't know a clever way but this should work.

set focus to the combo with control focus.

get the window text with WInGetText("Power Options Properties")

In that text will be the selected power option beginning with "Settings for ..."

Send({DOWN}")

Read the text again.

repeat until the text after "Settings for " no longer changes, then you have a count of the number of setting.

EDIT:Probably ControlGetText is more sensible than WInGetText.

Edited by martin
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

I think you maybe wanna see at what "powercfg" can do for you. There is no need to navigate GUI controls.

Examples:
    POWERCFG /LIST
    POWERCFG /QUERY scheme
    POWERCFG /QUERY
    POWERCFG /CREATE scheme
    POWERCFG /DELETE scheme
    POWERCFG /SETACTIVE scheme
    POWERCFG /CHANGE scheme /monitor-timeout-dc 15
    POWERCFG /CHANGE scheme /monitor-timeout-dc 0
    POWERCFG /HIBERNATE on
    POWERCFG /EXPORT scheme /file file
    POWERCFG /QUERY number /NUMERICAL
    POWERCFG /GLOBALPOWERFLAG on /OPTION BATTERYICON
    POWERCFG /AVAILABLESLEEPSTATES
    POWERCFG /BATTERYALARM low
    POWERCFG /BATTERYALARM critical /ACTIVATE on /LEVEL 6 /ACTION hibernate
    POWERCFG /DEVICEQUERY wake_armed
    POWERCFG /DEVICEENABLEWAKE "Microsoft USB IntelliMouse Explorer"
Edited by omikron48
Link to comment
Share on other sites

  • 7 months later...

How to set "do nothing"?

Start -> Control Panel -> Power Options -> Advanced --- Power Buttons "do nothing"

Code: Run("control.exe powercfg.cpl")

Code must choose Advanced, select "do nothing" and OK - close windows.

Sry my english ;)

Edited by Read
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...