'Battery information
Set objWMI = GetObject("winmgmts:\\.\root\CIMV2")
Set objA = objWMI.InstancesOf("Win32_Battery",48)
For Each objFish In objA
' The remaining time to charge the battery fully in minutes at the current charging rate and usage.
str= objFish.SystemName & VbCrLf
str=str & objFish.EstimatedChargeRemaining & " % Percent Remaining" & VbCrLf
minutes=objFish.EstimatedRunTime
hrs = Int(minutes/60)
miin = minutes Mod 60
str = str & " " & Int(minutes/60) & ":" & miin & " Hrs left" & VbCrLf
Next
'MsgBox str
Set objWMI = GetObject("winmgmts:\\.\root\WMI")
Set objA = objWMI.InstancesOf("BatteryStatus", 48)
For Each objFish In objA
'WScript.Echo objFish.getObjectText_
disch= objFish.Discharging
powe= objFish.PowerOnline
criti= objFish.Critical
chrg= objFish.Charging
Next
If disch < 0 Then
disch = "Discharging"
Else
disch =""
End If
If powe < 0 Then
powe = "Power Online"
Else
powe=""
End If
If criti < 0 Then
criti = "Critical"
Else
criti = ""
End If
If chrg < 0 Then
chrg = "Charging"
Else
chrg = ""
End If
'MsgBox ,,"Status"
Ststus="STATUS: " & disch & " " & powe & " " & criti & " " & chrg
MsgBox Ststus & VbCrLf & str, ," ЦГТІШΛТΞ ΠΛΡΣΤЯ "
Set objWMI = GetObject("winmgmts:\\.\root\CIMV2")
Set objA = objWMI.InstancesOf("Win32_Battery",48)
For Each objFish In objA
' The remaining time to charge the battery fully in minutes at the current charging rate and usage.
str= objFish.SystemName & VbCrLf
str=str & objFish.EstimatedChargeRemaining & " % Percent Remaining" & VbCrLf
minutes=objFish.EstimatedRunTime
hrs = Int(minutes/60)
miin = minutes Mod 60
str = str & " " & Int(minutes/60) & ":" & miin & " Hrs left" & VbCrLf
Next
'MsgBox str
Set objWMI = GetObject("winmgmts:\\.\root\WMI")
Set objA = objWMI.InstancesOf("BatteryStatus", 48)
For Each objFish In objA
'WScript.Echo objFish.getObjectText_
disch= objFish.Discharging
powe= objFish.PowerOnline
criti= objFish.Critical
chrg= objFish.Charging
Next
If disch < 0 Then
disch = "Discharging"
Else
disch =""
End If
If powe < 0 Then
powe = "Power Online"
Else
powe=""
End If
If criti < 0 Then
criti = "Critical"
Else
criti = ""
End If
If chrg < 0 Then
chrg = "Charging"
Else
chrg = ""
End If
'MsgBox ,,"Status"
Ststus="STATUS: " & disch & " " & powe & " " & criti & " " & chrg
MsgBox Ststus & VbCrLf & str, ," ЦГТІШΛТΞ ΠΛΡΣΤЯ "
No comments:
Post a Comment