自动切换电源计划的autohotkey脚本
笔记本吧
全部回复
仅看楼主
level 10
gc✨time 楼主
最近发现我的电源计划在平衡模式cpu并不降频,在节能模式才降频,尝试了一些方法后都不行,只能用脚本自动切换了,在打开指定的游戏窗口时自动切换,大家可以按需修改,主要需要改的是 powercfg_ids 那块改成自己笔记本 powercfg /list 列出的你需要的计划的模式 GroupAdd 那块现有的是打开Unity引擎的一些游戏和打开steam主窗口的时候变成性能模式 [滑稽][滑稽][滑稽]
#SingleInstance force
#warn
RyzenPowerPlanIDCheck()
{
objShell := ComObjCreate("WScript.Shell")
var := objShell.Exec("cmd /c powercfg /list").StdOut.ReadAll()
global powercfg_ids := ["381b4222-f694-41f0-9685-ff5bb260df2e","a1841308-3541-4fab-bc81-f71556f20b4a"]
for each, id in powercfg_ids
{
IfNotInString, var, %id%
{
msgbox, Looks like we're missing at least one or more Ryzen power plan ids. Didn't find %id% %var%
return
}
}
global powercfg_plan_RyzenBalanced = powercfg_ids[2]
global powercfg_plan_RyzenHighPerf = powercfg_ids[1]
}
RyzenPowerPlanIDCheck()
SetTitleMatchMode, 2
GroupAdd, GAMES_ALL, ahk_class UnityWndClass
GroupAdd, GAMES_ALL, ahk_class vguiPopupWindow
performance_amd_plan = 0
#Persistent
SetTimer, CheckGame, 10000
; return
CheckGame:
ex := WinExist("ahk_group GAMES_ALL")
; msgbox, %ex%
if (!performance_amd_plan && powercfg_plan_RyzenHighPerf && WinExist("ahk_group GAMES_ALL"))
{
performance_amd_plan = 1
; msgbox, perf 1
Run, powercfg -SETACTIVE %powercfg_plan_RyzenHighPerf%
}
else if (powercfg_plan_RyzenBalanced && performance_amd_plan && !WinExist("ahk_group GAMES_ALL"))
{
; msgbox, perf 2
performance_amd_plan = 0
Run, powercfg -SETACTIVE %powercfg_plan_RyzenBalanced%
}
return
2022年02月02日 12点02分 1
1