Sign in to follow this  
Followers 0
ricky

hardware information

11 posts in this topic

Hello,

I want to read some hardare information.

I want to read :

  • CPU temp (most important)
  • CPU fan speed (most important)
  • Other fan speed
  • Other temp in the motherboard
How can I do that?

Thanks in advance for your help

Regads

Ricky

Share this post


Link to post
Share on other sites



Search the forum for "CPU temperature" or "hardware temperature" and you'll get a lot of hits.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Hello,

before post, i found some topics, but not working solutions...

Who can help me?

Thanks in advance...

Share this post


Link to post
Share on other sites

There are some good examples and solutions on these.


[font="verdana, geneva, sans-serif"] [/font]

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Hi,

I've tried to retrieve the CPU temperature throught WMI MSAcpi_ThermalZoneTemperature but the information is not correct.

After searching the internet i found The Open Hardware monitor project

The Open Hardware Monitor publishes all sensor data to WMI RootOpenHardwareMonitor. This allows other applications to read and use the sensor information as well. A preliminary documentation of the interface can be found here -> http://openhardwaremonitor.org/wordpress/wp-content/uploads/2011/04/OpenHardwareMonitor-WMI.pdf

If found a working PHP example

function report_cpu_temp(){
$wmi = new COM('winmgmts://./root/OpenHardwareMonitor');
$result = $wmi->ExecQuery("SELECT * FROM Sensor");
foreach($result as $obj){
if($obj->SensorType == 'Temperature' && strpos($obj->Parent, 'cpu') > 0)
echo "$obj->Name ($obj->Value C)"; // output cpu core temp
else
echo 'skipping ' . $obj->Identifier ;
echo '
';
}
}

But i don't know how to translate

if($obj->SensorType == 'Temperature' && strpos($obj->Parent, 'cpu') > 0)

echo "$obj->Name ($obj->Value C)"; // output cpu core temp

Into AutoIt

TraySetState()
$wbemFlagReturnImmediately = 0x10
$wbemFlagForwardOnly = 0x20
$strComputer = "."
objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\OpenHardwareMonitor")
While 1
$colItems = $objWMIService.ExecQuery("SELECT * FROM Sensor", "WQL",$wbemFlagReturnImmediately + $wbemFlagForwardOnly)
$Instances = $objWMIService.InstancesOf("Sensor")
$Output=""
For $objItem in $colItems
$CurrTemp=$objItem.SensorType
$Output&= String(($CurrTemp/10) - 273.15) & "°C"& @crlf
Next
If $output = "" then
TraySetToolTip("No ACPI device found")
Else
    TraySetToolTip($output)
EndIf
Sleep(5000)
WEnd
exit
Edited by Emiel Wieldraaijer

Best regards,Emiel Wieldraaijer

Share this post


Link to post
Share on other sites

if $obj.SensorType = 'Temperature' & StringInStr($obj.Parent, 'cpu') > 0 Then MsgBox(0, "", $obj.Name & " " & $obj.Value & " C")
Not 100% sure that the translation of the echo line is correct.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Thanks Water

so strpos = stringinstr

Edited by Emiel Wieldraaijer

Best regards,Emiel Wieldraaijer

Share this post


Link to post
Share on other sites
Yes.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

hmmm .. why didn't i google that


Best regards,Emiel Wieldraaijer

Share this post


Link to post
Share on other sites

Don't know :D


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Download : http://openhardwaremonitor.org/files/openhardwaremonitor-v0.5.1-beta.zip

OpenHardwareMonitor.exe must be started in order to retrieve the information, it's also possible to retrieve the information through the openhardwaremonitorlib.dll but i don't know how

#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 ("Load", 10, 40, 100,20)
GUICtrlCreateLabel ("Power", 10, 70, 100,20)

$CPUTemp = GUICtrlCreateLabel("", 130, 10, 50, 20, $SS_RIGHT)
$CPULoad = GUICtrlCreateLabel("", 130, 40, 50, 20, $SS_RIGHT)
$CPUPower = GUICtrlCreateLabel("", 130, 70, 50, 20, $SS_RIGHT)

GUISetState()

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch

$colItems = $objWMIService.ExecQuery("SELECT * FROM Sensor", "WQL",$wbemFlagReturnImmediately + $wbemFlagForwardOnly)
$Output=""
$Power=""
$Load=""
For $objItem in $colItems
if $objItem.SensorType = 'Power' and StringInStr($objItem.Parent, 'cpu') Then
If StringInStr($objItem.Name , "Package") Then
_GuiCtrlSetData($CPUPower, Round($objItem.Value,1) & " W")
EndIf
EndIf
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 = 'Load' and StringInStr($objItem.Parent, 'cpu') Then
If StringInStr($objItem.Name , "Total") Then
_GuiCtrlSetData($CPULoad, Round($objItem.Value,1) & " %")
EndIf
EndIf
Next
WEnd

Func _GUICtrlSetData($iCtrlID, $sData)
If GUICtrlRead($iCtrlID, 1) <> $sData Then GUICtrlSetData($iCtrlID, $sData)
EndFunc ;==>_GUICtrlSetData
1 person likes this

Best regards,Emiel Wieldraaijer

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0