Search the Community
Showing results for tags 'fan speed'.
-
Hi! How to display the CPU fan speed according to this example: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <StaticConstants.au3> If not ProcessExists("OpenHardwareMonitor.exe") Then Msgbox (16, "Error", "Please start OpenHardwareMonitor.exe") Exit EndIf $wbemFlagReturnImmediately = 0x10 $wbemFlagForwardOnly = 0x20 $strComputer = "." $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\OpenHardwareMonitor") GUICreate ("CPU", 200,200) GUICtrlCreateLabel ("Temperature", 10, 10, 100, 20) GUICtrlCreateLabel ("Fan speed", 10, 40, 100, 20) $CPUTemp = GUICtrlCreateLabel("", 130, 10, 50, 20) $CPUFan = GUICtrlCreateLabel("", 130, 40, 50, 20) GUISetState() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch $colItems = $objWMIService.ExecQuery("SELECT * FROM Sensor", "WQL",$wbemFlagReturnImmediately + $wbemFlagForwardOnly) For $objItem in $colItems if $objItem.SensorType = 'Temperature' and StringInStr($objItem.Parent, 'cpu') Then If StringInStr($objItem.Name , "Package") Then _GuiCtrlSetData($CPUTemp, $objItem.Value & " °C") EndIf EndIf if $objItem.SensorType = 'Fan' and StringInStr($objItem.Parent, 'mainboard') Then If StringInStr($objItem.Name , "Fan #1") Then _GuiCtrlSetData($CPUFan, $objItem.Value & " RPM") EndIf EndIf Next WEnd Func _GUICtrlSetData($iCtrlID, $sData) If GUICtrlRead($iCtrlID, 1) <> $sData Then GUICtrlSetData($iCtrlID, $sData) EndFunc ;==>_GUICtrlSetData Sensor "Fan" does not work. Or I'm doing something wrong?