我从互联网上获得了一些警告指示器的代码。我用它来在电池充电且电池电量高于 80% 时发出警告。
但我也想用它在电池电量低于 20% 时发出警告。我已经为这个 20% 警告添加了一行,但它不起作用。当电池电量高于 80% 时可以使用,但当电池电量低于 20% 时则无法使用。
我认为代码是 Visual Basic Script (VBS) 中的。
请帮忙。
我已经在其他论坛和这个论坛上搜索过,但在任何地方都找不到这样的程序。
set oLocator = CreateObject("WbemScripting.SWbemLocator")
set oServices = oLocator.ConnectServer(".","root\wmi")
set oResults = oServices.ExecQuery("select * from batteryfullchargedcapacity")
for each oResult in oResults
iFull = oResult.FullChargedCapacity
next
while (1)
set oResults = oServices.ExecQuery("select * from batterystatus")
for each oResult in oResults
iRemaining = oResult.RemainingCapacity
bCharging = oResult.Charging
next
iPercent = ((iRemaining / iFull) * 100) mod 100
if bCharging and (iPercent > 80) …Run Code Online (Sandbox Code Playgroud)