• Welcome to TechPowerUp Forums, Guest! Please check out our forum guidelines for info related to our community.
  • The forums have been upgraded with support for dark mode. By default it will follow the setting on your system/browser. You may override it by scrolling to the end of the page and clicking the gears icon.

Script for Power Options

Joined
Jun 5, 2007
Messages
2,167 (0.33/day)
Location
Metro Manila, Philippines
System Name Zangief (Reborn) 2.0 AM4 not dead yet!
Processor AMD Ryzen R7 5700X3D (tweaked PBO)
Motherboard Gigabyte GA-AX370 Gaming K7 Rev 1.0 BIOS F53d
Cooling Noctua NH-D15 Push / Push Config | 2x ML120 | 2x Phanteks 120 mm
Memory 2x16GB G.Skill Trident Z Neo RGB @ 3600mhz CL 18 -> running 3800mhz @ 1.37v
Video Card(s) Asus RTX 3080 Rog Strix Gaming OC
Storage 250 GB Samsung Evo 850 / 1tb WD Black / 4tb WD Blue / 512GB Adata XPG Pro SX8200
Display(s) Acer Predator XB271HU |Asus VX239H 23" AH-IPS Led
Case Phanteks Enthoo Pro M TG
Audio Device(s) On Board Realtek HD | Steelseries Arctis Nova Pro Wireless
Power Supply Seasonic Focus GX V4 850 Watts ATX 3.1
Mouse Logitech G903
Keyboard AKKO 5098N (Otemu Cocoa Brown Lubed) | Tecware Spectre 96 (Akko Lavander Purple V3 lubed)
Software Windows 11 Pro 24H2
Specifically for pausing desktop slideshow.

Can anyone guide or help me set up a If -- Else script for toggling pause and available options for current power scheme.
Basically change Power Options > Advanced power settings > Desktop Settings > Slide show.
I can do it via cmd/powershell with powercfg but not really good with making a complex script.
like a 1 click on and off script that can read the value or something like that.

The command which can do this is.
powercfg -setacvalueindex or powercfg -setdcvalueindex plus the GUID of the setting.

Thank you.
 
powercfg -setacvalueindex or powercfg -setdcvalueindex


what is this index? is the value a number? do you know between what and what?

nvm seems like its

powercfg -setacvalueindex or powercfg -setdcvalueindex

are those the only two you need to toggle between?


no scratch that those are not valid flags, those are just the set value flags. Do you know the flag specifically for slide show?

ah ok, nvm I understand.

I can do this. Do you have a custom power plan? Or do you switch power plans often? The default plans are known GUIDs I can do this faster if I can be a bit lazy and just modify the default plans. If you use a custom one then I need to poll the current guid and make it a variable.
 
Last edited:
what is this index? is the value a number? do you know between what and what?

nvm seems like its

powercfg -setacvalueindex or powercfg -setdcvalueindex

are those the only two you need to toggle between?


no scratch that those are not valid flags, those are just the set value flags. Do you know the flag specifically for slide show?

ah ok, nvm I understand.

I can do this. Do you have a custom power plan? Or do you switch power plans often? The default plans are known GUIDs I can do this faster if I can be a bit lazy and just modify the default plans. If you use a custom one then I need to poll the current guid and make it a variable.


Hey there sorry for the delayed response.
I just use one power plan wihich is the Ryzen Balanced plan.
When I can get to the puter when I get home, I will put the guid's of the plan and the categories/sub categories.

On my own I managed to make a vbscript that can execute it but I need to have it store a file locally to put a marker that it paused or not, because when the script runs it exits and thinks that it starts again from the beggining.

I was trying to see if I can make it read the actual setting but I am limited with my coding skills.


Thank you in advance, I'll let you know the information when I get home.

EDIT:

Hello, these are the guids :)

9897998c-92de-4669-853f-b7cd3ecb2790 - Ryzen Balanced Plan
0d7dbae2-4294-402a-ba8e-26777e8488cd - Desktop BG Settings
309dce9b-bef4-4119-9921-a851fb12f0f4 - Slide show


This is vbs that I came up with but as I told earlier it quits it self and I haven't figured out how to make it read the current setting so that the IF Else work.

Thanks in advance and no rush. :)

Code:
Option Explicit

Dim WshShell
Dim Exec
Dim Enabled

Set WshShell = WScript.CreateObject("WScript.Shell")
Exec = "C:\Windows\SysWOW64\powercfg.exe"
Enabled = 0


If Enabled = 0 Then
    WshShell.Run (Exec) & " /SETACVALUEINDEX 9897998c-92de-4669-853f-b7cd3ecb2790 0d7dbae2-4294-402a-ba8e-26777e8488cd 309dce9b-bef4-4119-9921-a851fb12f0f4 1 "
    WshShell.Run (Exec) & " /SETDCVALUEINDEX 9897998c-92de-4669-853f-b7cd3ecb2790 0d7dbae2-4294-402a-ba8e-26777e8488cd 309dce9b-bef4-4119-9921-a851fb12f0f4 1 "
    Enabled = 1
    WScript.Echo "Slideshow Paused"
    WScript.Quit
Else
    WshShell.Run (Exec) & " /SETACVALUEINDEX 9897998c-92de-4669-853f-b7cd3ecb2790 0d7dbae2-4294-402a-ba8e-26777e8488cd 309dce9b-bef4-4119-9921-a851fb12f0f4 0 "
    WshShell.Run (Exec) & " /SETDCVALUEINDEX 9897998c-92de-4669-853f-b7cd3ecb2790 0d7dbae2-4294-402a-ba8e-26777e8488cd 309dce9b-bef4-4119-9921-a851fb12f0f4 0 "
    Enabled = 0
    WScript.Echo "Slideshow Enabled"
    WScript.Quit
End If

WScript.Quit
 
Last edited:
Back
Top