
我正在設定一台裝有 Windows 7 的新筆記型電腦,並且正在使用雨量計在側邊欄中顯示系統資訊(CPU、記憶體、GPU 資訊等)。這需要 MSI Afterburner 在後台運行來存取 GPU 統計資料。
不管怎樣,我意識到所有這些額外的軟體可能會縮短我的電池壽命,所以我正在尋找一種方法,在電池電量低於一定水平(例如50%)時自動退出這兩個程式(Rainmeter 和MSI )。我將 Autohotkey 用於其他用途,但尚未找到使用程式或任何其他程式的解決方案。
和想法?
答案1
這是一個腳本,當電池電量低於 50% 時,該腳本將關閉 2 個進程。
SetTimer, CheckBatteryLevel, 2000
Return
CheckBatteryLevel:
VarSetCapacity(powerstatus, 1+1+1+1+4+4)
success := DllCall("kernel32.dll\GetSystemPowerStatus", "uint", &powerstatus)
batteryLifePercent := ReadInteger(&powerstatus,2,1,false)
if (batteryLifePercent < 50)
{
KillIfExists("Rainmeter.exe")
KillIfExists("MSI.exe")
}
Return
KillIfExists(p)
{
Process, Exist, % p
If (ErrorLevel)
Process, Close, % p
}
ReadInteger( p_address, p_offset, p_size, p_hex=true )
{
value = 0
old_FormatInteger := a_FormatInteger
if ( p_hex )
SetFormat, integer, hex
else
SetFormat, integer, dec
loop, %p_size%
value := value+( *( ( p_address+p_offset )+( a_Index-1 ) ) << ( 8* ( a_Index-1 ) ) )
SetFormat, integer, %old_FormatInteger%
return, value
}
我修改了在中找到的程式碼這個帖子
答案2
看看這個。http://batterysaver.codeplex.com/
使您能夠根據電池電量減少來終止進程。
該程式處於開發的早期階段,用戶介面不太友好,但它仍然可以完成工作,值得稱讚瑞安埃默利感謝他為發展所做的辛勤工作。您必須以管理員身份執行程式並稍微嘗試一下才能使其正常運作。
答案3
這個答案是針對 Rainmeter 的。我沒有測試過,但是這插件可以測量電池百分比。您可以建立一個皮膚,用於if
測量電池何時下降到一定百分比以下,然後打開一個 exe,它是一個用於關閉 Rainmeter 的 Autohotkey 程式。
我知道這個問題很老了,但我想我會為有同樣問題的人添加兩分錢。我還沒有測試過它,但我認為它沒有理由不起作用。