Jump to content

hardware information


ricky
 Share

Recommended Posts

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 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

  • 4 months later...

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

Link to comment
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 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Yes.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Don't know :D

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

  • 4 weeks later...

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

Best regards,Emiel Wieldraaijer

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...