Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Functions.au3>
- #include <GUIConstantsEx.au3>
- #include <WindowsConstants.au3>
- #include <GuiButton.au3>
- $iState = _GetNetConnection()
- $iOldState = $iState
- $cState = _Battery_IsCharging()
- $cOldState = $cState
- Switch $cState
- Case True
- $cStateText = "Lädt"
- Case False
- $cStateText = "Entlädt"
- EndSwitch
- $Charge = _Battery_GetCharge()
- $OldCharge = _Battery_GetCharge()
- $Voltage = _Battery_GetVoltage()
- $OldVoltage = $Voltage
- $CPU = GetCPUUsage()
- $OldCPU = $CPU
- $gui = GUICreate("mInfo", 161, 133, -1, -1, -1, -1)
- If ($iState == True) Then
- $NetLabel = GUICtrlCreateLabel("Verbunden", 50, 110, 81, 15, -1, -1)
- GUICtrlSetColor($NetLabel, "0x00FF00")
- Else
- $NetLabel = GUICtrlCreateLabel("Nicht Verbunden", 50, 110, 81, 15, -1, -1)
- GUICtrlSetColor($NetLabel, "0xFF0000")
- EndIf
- GUICtrlCreateLabel("Internet:", 10, 110, 41, 15, -1, -1)
- GUICtrlCreateLabel("Akkuladung: ", 10, 10, 83, 15, -1, -1)
- $cStateLabel = GUICtrlCreateLabel("Akkustatus: " & $cStateText, 10, 30, 91, 15, -1, -1)
- $ChargeLabel = GUICtrlCreateLabel(_Battery_GetCharge() & "%", 73, 10, 83, 15, -1, -1)
- $VoltageLabel = GUICtrlCreateLabel("Spannung: " & _Battery_GetVoltage() & "V", 10, 50, 98, 15, -1, -1)
- $CPULabel = GUICtrlCreateLabel("CPU: " & GetCPUUsage() & "%", 10, 80, 100, 15, -1, -1)
- GUISetState(@SW_SHOW, $gui)
- While 1
- $nMsg = GUIGetMsg()
- Switch $nMsg
- Case $GUI_EVENT_CLOSE
- Exit
- EndSwitch
- $CPU = GetCPUUsage()
- If $CPU <> $OldCPU Then
- $OldCPU = $CPU
- GUICtrlSetData($CPULabel, "CPU: " & $CPU & "%")
- EndIf
- $Voltage = _Battery_GetVoltage()
- If $Voltage <> $OldVoltage Then
- $OldVoltage = $Voltage
- GUICtrlSetData($VoltageLabel, "Spannung: " & $Voltage & "V")
- EndIf
- $Charge = _Battery_GetCharge()
- If $Charge <> $OldCharge Then
- $OldCharge = $Charge
- GUICtrlSetData($ChargeLabel, $Charge & "%")
- EndIf
- $cState = _Battery_IsCharging()
- If $cState <> $cOldState Then
- $cOldState = $cState
- If (_Battery_IsCharging() == True) Then
- GUICtrlSetData($cStateLabel, "Akkustatus: Lädt")
- Else
- GUICtrlSetData($cStateLabel, "Akkustatus: Entlädt")
- EndIf
- EndIf
- $iState = _GetNetConnection()
- If $iState <> $iOldState Then
- $iOldState = $iState
- If ($iState == True) Then
- GUICtrlSetData($NetLabel, "Verbunden")
- GUICtrlSetColor($NetLabel, 0x00FF00)
- Else
- GUICtrlSetData($NetLabel, "Nicht Verbunden")
- GUICtrlSetColor($NetLabel, 0xFF0000)
- EndIf
- EndIf
- WEnd
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement