Sign in to follow this  
Followers 0
alexanderpavlovirk

Get CPU temperature as in EVEREST?

7 posts in this topic

#1 ·  Posted (edited)

Hello, please tell me how to get through autoit script CPU temperature (which will equal the temperature of which displays the program EVEREST)?

Or how to get in autoit script data from the program EVEREST?

Thanks in advance.

Edited by alexanderpavlovirk

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

http://www.autoitscript.com/forum/index.php?showtopic=115733

If you mean this code below it is not true displays the CPU temperature.

#NoTrayIcon
#include <iWMILib.au3>

_iWMI_Initialize()

$iConnection = _iWMI_Connect("localhost",0,"","", "root\WMI" ) ; Assume you have privs to execute the query
if @error Then
        ConsoleWrite("Error!" & @CRLF )
EndIf
$cObjects = _iWMI_ExecQueryRaw( $iConnection, "SELECT * FROM MSAcpi_ThermalZoneTemperature", False )
if @error Then
        ConsoleWrite("Error!" & @CRLF )
EndIf

For $oObject In $cObjects
        $temperature    = ( $oObject.CurrentTemperature - 2732.0) / 10.0                    ; Convert to Celsius from 0.1 Kelvins
        $critical       = ( $oObject.CriticalTripPoint - 2732.0) / 10.0                     ; Convert to Celsius from 0.1 Kelvins
        ConsoleWrite( $temperature & @CRLF )
        ConsoleWrite( $critical & @CRLF )
Next

Note: I need to check the internal temperature at the Mobile Intel Celeron M 380.

Edited by alexanderpavlovirk

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

I have fulfilled its task with the help of a script (which draws a graph of the values taken from EVEREST):

#NoTrayIcon
#include <iWMILib.au3>
#include <GUIConstantsEx.au3>

_iWMI_Initialize()

GUICreate("WMI addon for EVEREST", 620, 314, -1, -1, -1, 0x2000000)
        $contID = GUICtrlCreateLabel("Value", 575, 138)

Global $aData[101]
Global $gGraph = _Graph_Create(50, 18, 513, 254)
_Graph_SetRange_X($gGraph, 1, 100, 0)
_Graph_SetRange_Y($gGraph, 0, 100, 10)
_Redraw()

GUISetState()
Do
    _Randomise()
    _Redraw()
Until GUIGetMsg() = -3

Func _Randomise()   
    $cObjects = _iWMI_ExecQueryRaw( _iWMI_Connect("localhost",0,"","", "Root\WMI" ), "SELECT * FROM EVEREST_SensorValues", False )
    For $oObject In $cObjects
    Next
        GUICtrlSetData($contID, $oObject.Value)
    If $aData[100] <> $oObject.Value Then
    For $i = 1 To 99
        $aData[$i] = $aData[$i + 1]
    Next
    $aData[100] = $oObject.Value
    EndIf
EndFunc   ;==>_Randomise

Func _Redraw()
    GUISetState(@SW_LOCK)
    _Graph_Clear($gGraph)
    _Graph_SetGrid_X($gGraph, 5, 0x468c2f)
    _Graph_SetGrid_Y($gGraph, 10, 0x468c2f)
    _Graph_Set_Color($gGraph, 0xF9F32B)
    _Graph_Plot_Start($gGraph, 1, $gGraph[1])
    For $i = 1 To 100
        _Graph_Plot_Line($gGraph, $i, $aData[$i])
    Next
    _Graph_Refresh($gGraph)
    GUISetState(@SW_UNLOCK)
EndFunc   ;==>_Redraw

Func _Graph_Create($iLeft, $iTop, $iWidth, $iHeight, $hColourBorder = 0x000000, $hColorFill = 0xFFFFFF)
    $hWnd = GUICtrlCreateGraphic($iLeft, $iTop, $iWidth + 1, $iHeight + 1)
    GUICtrlSetColor(-1, $hColourBorder)
    GUICtrlSetBkColor(-1, $hColorFill)
    Local $ahTicksLabelsX[1]
    Local $ahTicksLabelsY[1]
    Local $ahTicksX[1]
    Local $ahTicksY[1]
    Dim $aGraphArray[16] = ["", $hWnd, $iLeft, $iTop, $iWidth, $iHeight, 0, 1, 0, 1, _
            $ahTicksX, $ahTicksLabelsX, $ahTicksY, $ahTicksLabelsY, $hColourBorder, $hColorFill]
    Return $aGraphArray
EndFunc   ;==>_Graph_Create

Func _Graph_Clear(ByRef $aGraphArray)
    GUICtrlDelete($aGraphArray[1])
    $aGraphArray[1] = GUICtrlCreateGraphic($aGraphArray[2], $aGraphArray[3], _
            $aGraphArray[4] + 1, $aGraphArray[5] + 1)
    GUICtrlSetBkColor(-1, 0x000000)
    GUICtrlSetColor(-1, 0x000000)
EndFunc   ;==>_Graph_Clear

Func _Graph_SetRange_X(ByRef $aGraphArray, $iLow, $iHigh, $iXTicks = 1, $bLabels = 1, $iRound = 0)
    ;----- load user vars to array -----
    $aGraphArray[6] = $iLow
    $aGraphArray[7] = $iHigh
    ;----- prepare nested array -----
    $ahTicksX = $aGraphArray[10]
    $ahTicksLabelsX = $aGraphArray[11]
    ;----- delete any existing ticks -----
    For $i = 1 to (UBound($ahTicksX) - 1)
        GUICtrlDelete($ahTicksX[$i])
    Next
    Dim $ahTicksX[1]
    ;----- create new ticks -----
    For $i = 1 To $iXTicks + 1
        ReDim $ahTicksX[$i + 1]
        $ahTicksX[$i] = GUICtrlCreateLabel("", (($i - 1) * ($aGraphArray[4] / $iXTicks)) + $aGraphArray[2], _
                $aGraphArray[3] + $aGraphArray[5], 1, 5)
        GUICtrlSetBkColor(-1, 0x000000)
        GUICtrlSetState(-1, $GUI_DISABLE)
    Next
    ;----- delete any existing labels -----
    For $i = 1 to (UBound($ahTicksLabelsX) - 1)
        GUICtrlDelete($ahTicksLabelsX[$i])
    Next
    Dim $ahTicksLabelsX[1]
    ;----- create new labels -----
    For $i = 1 To $iXTicks + 1
        ReDim $ahTicksLabelsX[$i + 1]
        $ahTicksLabelsX[$i] = GUICtrlCreateLabel("", _
                ($aGraphArray[2] + (($aGraphArray[4] / $iXTicks) * ($i - 1))) - (($aGraphArray[4] / $iXTicks) / 2), _
                $aGraphArray[3] + $aGraphArray[5] + 10, $aGraphArray[4] / $iXTicks, 13, 1)
        GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
    Next
    ;----- if labels are required, then fill -----
    If $bLabels = 1 Then
        For $i = 1 To (UBound($ahTicksLabelsX) - 1)
            GUICtrlSetData($ahTicksLabelsX[$i], _
                    StringFormat("%." & $iRound & "f", _Graph_Reference_Pixel("p", (($i - 1) * ($aGraphArray[4] / $iXTicks)), _
                    $aGraphArray[6], $aGraphArray[7], $aGraphArray[4])))
        Next
    EndIf
    ;----- load created arrays back into array -----
    $aGraphArray[10] = $ahTicksX
    $aGraphArray[11] = $ahTicksLabelsX
EndFunc   ;==>_Graph_SetRange_X

Func _Graph_SetRange_Y(ByRef $aGraphArray, $iLow, $iHigh, $iYTicks = 1, $bLabels = 1, $iRound = 0)
    ;----- load user vars to array -----
    $aGraphArray[8] = $iLow
    $aGraphArray[9] = $iHigh
    ;----- prepare nested array -----
    $ahTicksY = $aGraphArray[12]
    $ahTicksLabelsY = $aGraphArray[13]
    ;----- delete any existing ticks -----
    For $i = 1 to (UBound($ahTicksY) - 1)
        GUICtrlDelete($ahTicksY[$i])
    Next
    Dim $ahTicksY[1]
    ;----- create new ticks -----
    For $i = 1 To $iYTicks + 1
        ReDim $ahTicksY[$i + 1]
        $ahTicksY[$i] = GUICtrlCreateLabel("", $aGraphArray[2] - 5, _
                ($aGraphArray[3] + $aGraphArray[5]) - (($aGraphArray[5] / $iYTicks) * ($i - 1)), 5, 1)
        GUICtrlSetBkColor(-1, 0x000000)
        GUICtrlSetState(-1, $GUI_DISABLE)
    Next
    ;----- delete any existing labels -----
    For $i = 1 to (UBound($ahTicksLabelsY) - 1)
        GUICtrlDelete($ahTicksLabelsY[$i])
    Next
    Dim $ahTicksLabelsY[1]
    ;----- create new labels -----
    For $i = 1 To $iYTicks + 1
        ReDim $ahTicksLabelsY[$i + 1]
        $ahTicksLabelsY[$i] = GUICtrlCreateLabel("", $aGraphArray[2] - 40, _
                ($aGraphArray[3] + $aGraphArray[5]) - (($aGraphArray[5] / $iYTicks) * ($i - 1)) - 6, 30, 13, 2)
        GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
    Next
    ;----- if labels are required, then fill -----
    If $bLabels = 1 Then
        For $i = 1 To (UBound($ahTicksLabelsY) - 1)
            GUICtrlSetData($ahTicksLabelsY[$i], StringFormat("%." & $iRound & "f", _Graph_Reference_Pixel("p", _
                    (($i - 1) * ($aGraphArray[5] / $iYTicks)), $aGraphArray[8], $aGraphArray[9], $aGraphArray[5])))
        Next
    EndIf
    ;----- load created arrays back into array -----
    $aGraphArray[12] = $ahTicksY
    $aGraphArray[13] = $ahTicksLabelsY
EndFunc   ;==>_Graph_SetRange_Y

Func _Graph_Plot_Start(ByRef $aGraphArray, $iX, $iY)
    ;----- MOVE pen to start point -----
    GUICtrlSetGraphic($aGraphArray[1], $GUI_GR_MOVE, _
            _Graph_Reference_Pixel("x", $iX, $aGraphArray[6], $aGraphArray[7], $aGraphArray[4]), _
            _Graph_Reference_Pixel("y", $iY, $aGraphArray[8], $aGraphArray[9], $aGraphArray[5]))
EndFunc   ;==>_Graph_Plot_Start

Func _Graph_Plot_Line(ByRef $aGraphArray, $iX, $iY)
    ;----- Draw line from previous point to new point -----
    GUICtrlSetGraphic($aGraphArray[1], $GUI_GR_LINE, _
            _Graph_Reference_Pixel("x", $iX, $aGraphArray[6], $aGraphArray[7], $aGraphArray[4]), _
            _Graph_Reference_Pixel("y", $iY, $aGraphArray[8], $aGraphArray[9], $aGraphArray[5]))
EndFunc   ;==>_Graph_Plot_Line

Func _Graph_Set_Color(ByRef $aGraphArray, $hColor, $hBkGrdColor = $GUI_GR_NOBKCOLOR)
    GUICtrlSetGraphic($aGraphArray[1], $GUI_GR_COLOR, $hColor, $hBkGrdColor)
EndFunc   ;==>_Graph_Set_Color

Func _Graph_SetGrid_X(ByRef $aGraphArray, $Ticks = 1, $hColor = 0xf0f0f0)
    _Graph_Set_Color($aGraphArray, $hColor, $GUI_GR_NOBKCOLOR)
    Select
        Case $Ticks > 0
            For $i = $aGraphArray[6] To $aGraphArray[7] Step $Ticks
                If $i = Number($aGraphArray[6]) Or $i = Number($aGraphArray[7]) Then ContinueLoop
                GUICtrlSetGraphic($aGraphArray[1], $GUI_GR_RECT, _ ;rectangle
                        _Graph_Reference_Pixel("x", $i, $aGraphArray[6], $aGraphArray[7], $aGraphArray[4]), _ ;x
                        1, _ ;y
                        1, _ ;width
                        $aGraphArray[5] - 1) ;height
            Next
    EndSelect
    _Graph_Set_Color($aGraphArray, 0x000000)
EndFunc   ;==>_Graph_SetGrid_X

Func _Graph_SetGrid_Y(ByRef $aGraphArray, $Ticks = 1, $hColor = 0xf0f0f0)
    _Graph_Set_Color($aGraphArray, $hColor, $GUI_GR_NOBKCOLOR)
    Select
        Case $Ticks > 0
            For $i = $aGraphArray[8] To $aGraphArray[9] Step $Ticks
                If $i = Number($aGraphArray[8]) Or $i = Number($aGraphArray[9]) Then ContinueLoop
                GUICtrlSetGraphic($aGraphArray[1], $GUI_GR_RECT, _ ;rectangle
                        1, _ ;x
                        _Graph_Reference_Pixel("y", $i, $aGraphArray[8], $aGraphArray[9], $aGraphArray[5]), _ ;y
                        $aGraphArray[4] - 1, _ ;width
                        1) ;height
            Next
    EndSelect
    _Graph_Set_Color($aGraphArray, 0x000000)
EndFunc   ;==>_Graph_SetGrid_Y

Func _Graph_Refresh(ByRef $aGraphArray)
    GUICtrlSetGraphic($aGraphArray[1], $GUI_GR_REFRESH)
EndFunc   ;==>_Graph_Refresh

Func _Graph_Reference_Pixel($iType, $iValue, $iLow, $iHigh, $iTotalPixels)
    ;----- perform pixel reference calculations -----
    Switch $iType
        Case "x"
            Return (($iTotalPixels / ($iHigh - $iLow)) * (($iHigh - $iLow) * (($iValue - $iLow) / ($iHigh - $iLow))))
        Case "y"
            Return ($iTotalPixels - (($iTotalPixels / ($iHigh - $iLow)) * (($iHigh - $iLow) * (($iValue - $iLow) / ($iHigh - $iLow)))))
        Case "p"
            Return ($iValue / ($iTotalPixels / ($iHigh - $iLow))) + $iLow
    EndSwitch
EndFunc   ;==>_Graph_Reference_Pixel

I would be happy comments and changes the script.

For the script to the program Everest enable "WMI" as shown in the picture:Posted Image

Edited by alexanderpavlovirk

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Compiled script for EVEREST located at this address:

WMI addon for EVEREST

---

Thank you all.

Edited by alexanderpavlovirk

Share this post


Link to post
Share on other sites

Good you show the results. Looks nice.

Share this post


Link to post
Share on other sites

easiest solution : don't share value by WMI but write in registry, and get value in this branch :

"HKEY_CURRENT_USER\Software\Lavalys\EVEREST\SensorValues"

example : $cpu_usage = RegRead ( "HKEY_CURRENT_USER\Software\Lavalys\EVEREST\SensorValues", "Value.TCPU" )

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