Old 9th July 2010, 17:21   #1
The Raddish
Junior Member
 
Join Date: May 2010
Posts: 15
Question Change Power configuration

Has anyone figured out a way to change the 'Advanced' settings in the 'Power Options Properties' of a Windows XP machine from an installer?

Powercfg works for the 'Power Schemes', but not for anything in the 'Advanced' tab. I've googled and googled and have come up short.

As a workaround, I have the following in my script, but I don't like this method and I'd really prefer to make it automated if at all possible.

PHP Code:
Section
  ExecShell 
"" "$SYSDIR\Powercfg.cpl"
  
MessageBox MB_OK "Click on the 'Advanced' tab.  In the 'Power Buttons' heading, \
  change the option for 'When I close the lid of my portable computer:' to 'Do Nothing'. \
  Then click 'Apply' and close the window.  The installation will then continue."
    
SectionEnd 
The Raddish is offline   Reply With Quote
Old 9th July 2010, 20:31   #2
Zinthose
Senior Member
 
Join Date: May 2009
Posts: 152
The power settings are stored in the RegBinary value:
Quote:
HKCU\Control Panel\PowerCfg\GlobalPowerPolicy\Policies
I don't know exactly what needs changed but you can do a before and after comparison easily enough.
Zinthose is offline   Reply With Quote
Old 12th July 2010, 13:39   #3
The Raddish
Junior Member
 
Join Date: May 2010
Posts: 15
Yeah, I've done this over and over. Changing here doesn't work.

I've used RegShot to see the differences and changed them, but testing shows that while the registry entries are indeed changed, the actual power configuration on the 'Advanced' tab is not. This seems to be a common theme all across the interwebz.

I was just hoping that someone here had figured out a way to do it from within NSIS.
The Raddish is offline   Reply With Quote
Old 14th July 2010, 12:38   #4
Animaether
Major Dude
 
Join Date: Jun 2001
Posts: 1,173
Technically, you'd have to change the power policy - lots of System plugin interaction - nom. See:
edit: the link gets killed because it's a .info site - go figure
http://www.databaseforum[dot]info/30/648583.aspx

I'm not sure if there's a simpler API call that just lets windows pick up on the new registry settings - I would suspect those values are written as a result of policy changes, rather than used as a reference (except after a reboot, maybe).
The system itself sends WM_POWERBROADCAST PBT_POWERSETTINGCHANGE ... to applications to signal setting changes. I presume you've already googled those to death, though.
Animaether is offline   Reply With Quote
Old 15th July 2010, 18:19   #5
Zinthose
Senior Member
 
Join Date: May 2009
Posts: 152
I found the APIs to use and have them working in AutoIt... I just need to convert them to NSIS.

I haven't abandoned you.. it's just more complicated than I thought..

Last edited by Zinthose; 15th July 2010 at 18:19. Reason: Me has bad grammar!
Zinthose is offline   Reply With Quote
Old 16th July 2010, 09:03   #6
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Put them in an executable or DLL and run it. Simples!

Stu
Afrow UK is offline   Reply With Quote
Old 16th July 2010, 13:34   #7
Zinthose
Senior Member
 
Join Date: May 2009
Posts: 152
It's only simple if you know how to program in a VC++ environment. It's on my todo list to learn though.

Last edited by Zinthose; 16th July 2010 at 13:38. Reason: Double post
Zinthose is offline   Reply With Quote
Old 16th July 2010, 17:22   #8
The Raddish
Junior Member
 
Join Date: May 2010
Posts: 15
I kept playing with it too, but no matter what resource I used I couldn't get it to work.

I'm using my workaround at the moment, but my goal is to make the installer unattended in the long run so I'm anxious to get it working.

I absolutely appreciate any work you put in to making this work, as I am sure does the rest of the internetz.
The Raddish is offline   Reply With Quote
Old 22nd July 2010, 17:30   #9
The Raddish
Junior Member
 
Join Date: May 2010
Posts: 15
I got to thinking about this a bit. AutoIt can compile standalone executable from the scripts. Why not just create the exe and call it from NSIS?

If you have a working AutoIt script, can you post the script here?
The Raddish is offline   Reply With Quote
Old 22nd July 2010, 20:39   #10
Animaether
Major Dude
 
Join Date: Jun 2001
Posts: 1,173
isn't AutoIt rather UI-dependent? I.e. you tell it to "click this button, now click this one, now click in this field and 'type' this number", etc. Given the power scheme bits and pieces vary between Windows versions, that doesn't seem like a prudent path.
Animaether is offline   Reply With Quote
Reply
Go Back   Winamp & SHOUTcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump