# Script for Power Options



## psyko12 (Aug 24, 2019)

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.


----------



## Solaris17 (Aug 25, 2019)

psyko12 said:


> 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 -set*a*cvalueindex or powercfg -set*d*cvalueindex

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.


----------



## psyko12 (Aug 25, 2019)

Solaris17 said:


> what is this index? is the value a number? do you know between what and what?
> 
> nvm seems like its
> 
> ...




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. 


```
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
```


----------

