SK
Size: a a a
SK
ВЗ
ВЗ
AP
SK
SK
SK
' Warning message if Laptop Battery is operated
Function WarnIsOnBattery(sTitle, sText, iTimeOut)
oLogging.CreateEntry "OSDPreStartTool: Entered WarnIsOnBattery", LogTypeInfo
oLogging.CreateEntry "OSDPreStartTool: Env IsOnBattery = " & oEnvironment.Item("IsOnBattery"), LogTypeInfo
' Later: Add Warn without paused script: https://gallery.technet.microsoft.com/scriptcenter/3579394b-ac53-4ba5-9357-ea8efd59646d
If oEnvironment.Item("IsOnBattery") = "True" then
oLogging.CreateEntry "OSDPreStartTool: IsOnBattery = " & oEnvironment.Item("IsOnBattery") & " - warning!", LogTypeInfo
oShell.Popup sText, iTimeOut, sTitle, vbOKOnly + vbExclamation
End if
WarnIsOnBattery = Success
End Function
SK
SK
Set objResults = objWMI.InstancesOf("Win32_Battery")
For each objInstance in objResults
bFoundBattery = True
If objInstance.BatteryStatus = 2 then
bFoundAC = True
End if
Next
If bFoundBattery and (not bFoundAC) then
bOnBattery = True
Else
bOnBattery = False
End if
SK
AP
ВЗ
A
AP
ВЗ
ВЗ
ВЗ
D
D