James Posted March 10, 2009 Posted March 10, 2009 (edited) I thought I'd share this with you as a "snippet" because it may just come in useful. I am currently using it for Disk Manager As far as I know, it works fine - fingers crossed.Global $strComputer = "." Global $objWMIService, $oMyError Global $colTemp $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc") $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\WMI") $colTemp = $objWMIService.ExecQuery("SELECT * FROM MSStorageDriver_ATAPISmartData") For $objItem In $colTemp $strVendorSpecific = $objItem.VendorSpecific ConsoleWrite("Temperature: " & $strVendorSpecific[115] & @CRLF) Next Func MyErrFunc() $HexNumber = Hex($oMyError.number, 8) MsgBox(0, "COM Error Test", "We intercepted a COM Error !" & @CRLF & @CRLF & _ "err.description is: " & @TAB & $oMyError.description & @CRLF & _ "err.windescription:" & @TAB & $oMyError.windescription & @CRLF & _ "err.number is: " & @TAB & $HexNumber & @CRLF & _ "err.lastdllerror is: " & @TAB & $oMyError.lastdllerror & @CRLF & _ "err.scriptline is: " & @TAB & $oMyError.scriptline & @CRLF & _ "err.source is: " & @TAB & $oMyError.source & @CRLF & _ "err.helpfile is: " & @TAB & $oMyError.helpfile & @CRLF & _ "err.helpcontext is: " & @TAB & $oMyError.helpcontext _ ) SetError(1); to check for after this function returns EndFunc ;==>MyErrFunc Edited July 4, 2013 by James Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ
FireFox Posted March 10, 2009 Posted March 10, 2009 @JamesBrooks "Temperature: 2", I dont think its normal Cheers, FireFox.
James Posted March 10, 2009 Author Posted March 10, 2009 I must be picking up the wrong part of the array. I will look into it a bit more. Thanks Firefox Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ
FireFox Posted March 10, 2009 Posted March 10, 2009 @JamesBrooks I've done some tests and found some arrays matching with my Drive temperature : $strVendorSpecific[127] $strVendorSpecific[130] $strVendorSpecific[137] $strVendorSpecific[139] Cheers, FireFox.
James Posted March 10, 2009 Author Posted March 10, 2009 No, I have looked at examples of MSStorageDriver_ATAPISMARTDATA and they are using the same index. Be aware that the function may be different depending on the motherboard manufacturer. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ
FireFox Posted March 10, 2009 Posted March 10, 2009 @JamesBrooks then your function is useless in the way it returns false temperature... Cheers, FireFox.
James Posted March 10, 2009 Author Posted March 10, 2009 FireFox said: then your function is useless in the way it returns false temperature...No, because there is no sure fire way of doing it. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ
FireFox Posted March 10, 2009 Posted March 10, 2009 @JamesBrooks hm... but its possible that it could be my drive temperature I will check it again, when my drive temperature will change Cheers, FireFox.
James Posted March 10, 2009 Author Posted March 10, 2009 FireFox said: I will check it again, when my drive temperature will changeOpen a load of documents Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ
FireFox Posted March 10, 2009 Posted March 10, 2009 @JamesBrooks Thanks, I've arrived to get +1 °C And it works for all variables I gave Cheers, FireFox.
FireFox Posted March 10, 2009 Posted March 10, 2009 @JamesBrooks Here is my little example : expandcollapse popupLocal $strComputer = '.', $objWMIService, $oMyError, $colTemp $oMyError = ObjEvent('AutoIt.Error', 'MyErrFunc') $objWMIService = ObjGet('winmgmts:\\' & $strComputer & '\root\WMI') Opt('GUIOnEventMode', 1) #Region GUI $GUI = GUICreate('Drive temperature', 120, 75) GUISetOnEvent(-3, '_Exit') $tmp = GUICtrlCreateLabel('0 °C', 0, 5, 120, 40, 1) GUICtrlSetFont($tmp, 24) GUICtrlCreateButton('Refresh', 35, 50, 50, 20) GUICtrlSetOnEvent(-1, '_RefreshTemp') GUISetState(@SW_SHOW, $GUI) #EndRegion GUI ; While 1 Sleep(250) WEnd Func _Exit() Exit EndFunc ;==>_Exit Func _RefreshTemp() GUICtrlSetData($tmp, _WMI_DriveTemperature() & ' °C') TraySetToolTip(_WMI_DriveTemperature() & ' °C') EndFunc ;==>_RefreshTemp Func _WMI_DriveTemperature() $colTemp = $objWMIService.ExecQuery('SELECT * FROM MSStorageDriver_ATAPISmartData') For $objItem In $colTemp $strVendorSpecific = $objItem.VendorSpecific Return $strVendorSpecific[127] Next EndFunc ;==>_WMI_DriveTemperature Func MyErrFunc() $HexNumber = Hex($oMyError.number, 8) MsgBox(64, 'COM Error Test', 'We intercepted a COM Error !' & @CRLF & @CRLF & _ 'err.description is: ' & @TAB & $oMyError.description & @CRLF & _ 'err.windescription:' & @TAB & $oMyError.windescription & @CRLF & _ 'err.number is: ' & @TAB & $HexNumber & @CRLF & _ 'err.lastdllerror is: ' & @TAB & $oMyError.lastdllerror & @CRLF & _ 'err.scriptline is: ' & @TAB & $oMyError.scriptline & @CRLF & _ 'err.source is: ' & @TAB & $oMyError.source & @CRLF & _ 'err.helpfile is: ' & @TAB & $oMyError.helpfile & @CRLF & _ 'err.helpcontext is: ' & @TAB & $oMyError.helpcontext _ ) SetError(1); to check for after this function returns EndFunc ;==>MyErrFunc Cheers, FireFox.
James Posted March 10, 2009 Author Posted March 10, 2009 Your example shows 101 Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ
Ascend4nt Posted March 11, 2009 Posted March 11, 2009 (edited) JamesBrooks said: Your example shows 101 I think this is a very vendor-specific thing. For my Maxtor and Hitachi drives, I was reading the temp at [149]. I used 'SpeedFan' to match them up. Unfortunately, readings seemed off for both SpeedFan and the results. Doing searches on smartvsd.vxd and SMART IOCTL API might help.. *I should note: 'vxd' drivers were for Win9x systems.. not sure what NT-based systems use for the interface Edited March 11, 2009 by ascendant My contributions: Reveal hidden contents Performance Counters in Windows - Measure CPU, Disk, Network etc Performance | Network Interface Info, Statistics, and Traffic | CPU Multi-Processor Usage w/o Performance Counters | Disk and Device Read/Write Statistics | Atom Table Functions | Process, Thread, & DLL Functions UDFs | Process CPU Usage Trackers | PE File Overlay Extraction | A3X Script Extract | File + Process Imports/Exports Information | Windows Desktop Dimmer Shade | Spotlight + Focus GUI - Highlight and Dim for Eyestrain Relief | CrossHairs (FullScreen) | Rubber-Band Boxes using GUI's (_GUIBox) | GUI Fun! | IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) | Magnifier (Vista+) Functions UDF | _DLLStructDisplay (Debug!) | _EnumChildWindows (controls etc) | _FileFindEx | _ClipGetHTML | _ClipPutHTML + ClipPutHyperlink | _FileGetShortcutEx | _FilePropertiesDialog | I/O Port Functions | File(s) Drag & Drop | _RunWithReducedPrivileges | _ShellExecuteWithReducedPrivileges | _WinAPI_GetSystemInfo | dotNETGetVersions | Drive(s) Power Status | _WinGetDesktopHandle | _StringParseParameters | Screensaver, Sleep, Desktop Lock Disable | Full-Screen Crash Recovery Wrappers/Modifications of others' contributions: _DOSWildcardsToPCRegEx (original code: RobSaunder's) | WinGetAltTabWinList (original: Authenticity) UDF's added support/programming to: _ExplorerWinGetSelectedItems | MIDIEx UDF (original code: eynstyne) (All personal code/wrappers centrally located at Ascend4nt's AutoIT Code)
James Posted March 11, 2009 Author Posted March 11, 2009 I did say manufacturers change how/where the results are stored. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ
Ascend4nt Posted March 11, 2009 Posted March 11, 2009 You said motherboard manufacturers.. I think instead Drive Temps are more of a hard-drive manufacturer thing, no? My contributions: Reveal hidden contents Performance Counters in Windows - Measure CPU, Disk, Network etc Performance | Network Interface Info, Statistics, and Traffic | CPU Multi-Processor Usage w/o Performance Counters | Disk and Device Read/Write Statistics | Atom Table Functions | Process, Thread, & DLL Functions UDFs | Process CPU Usage Trackers | PE File Overlay Extraction | A3X Script Extract | File + Process Imports/Exports Information | Windows Desktop Dimmer Shade | Spotlight + Focus GUI - Highlight and Dim for Eyestrain Relief | CrossHairs (FullScreen) | Rubber-Band Boxes using GUI's (_GUIBox) | GUI Fun! | IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) | Magnifier (Vista+) Functions UDF | _DLLStructDisplay (Debug!) | _EnumChildWindows (controls etc) | _FileFindEx | _ClipGetHTML | _ClipPutHTML + ClipPutHyperlink | _FileGetShortcutEx | _FilePropertiesDialog | I/O Port Functions | File(s) Drag & Drop | _RunWithReducedPrivileges | _ShellExecuteWithReducedPrivileges | _WinAPI_GetSystemInfo | dotNETGetVersions | Drive(s) Power Status | _WinGetDesktopHandle | _StringParseParameters | Screensaver, Sleep, Desktop Lock Disable | Full-Screen Crash Recovery Wrappers/Modifications of others' contributions: _DOSWildcardsToPCRegEx (original code: RobSaunder's) | WinGetAltTabWinList (original: Authenticity) UDF's added support/programming to: _ExplorerWinGetSelectedItems | MIDIEx UDF (original code: eynstyne) (All personal code/wrappers centrally located at Ascend4nt's AutoIT Code)
billthecreator Posted March 11, 2009 Posted March 11, 2009 what can i use to find the temp for all drives if i dont know the number. i have OLE/COM Viewer. where can i find the commands for it [font=Microsoft Sans Serif]My Scripts: From Most recent to least.[/font]Countdown GUI | QLOCK TWO | FlipClock | Slot Machine My UDF:_GenerateRandomNoRepeat | _GuiSnap
James Posted March 11, 2009 Author Posted March 11, 2009 From what I have read, it also depends on the computer manufacturer. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ
UEZ Posted March 11, 2009 Posted March 11, 2009 (edited) These values seem to be the one for my pc: ConsoleWrite("Temperature: " & $strVendorSpecific[127] & @CRLF) ConsoleWrite("Temperature: " & $strVendorSpecific[173] & @CRLF) ConsoleWrite("Temperature: " & $strVendorSpecific[175] & @CRLF) Temperature: 44 Temperature: 44 Temperature: 44 My WMI output: expandcollapse popupActive: True Checksum: 250 ErrorLogCapability: 1 ExtendedPollTimeInMinutes: 111 InstanceName: IDE\DiskST9120823AS_____________________________3.ADC___\5&1d98b533&0&0.0.0_0 Length: 512 OfflineCollectCapability: 83 OfflineCollectionStatus: 0 Reserved: 3,0,0,0,0,0,0,0,0,0,0,0 SelfTestStatus: 38 ShortPollTimeInMinutes: 2 SmartCapability: 3 TotalTime: 426 VendorSpecific: 10,0,1,15,0,100,253,0,0,0,0,0,0,0,3,3,0,98,98,0,0,0,0,0,0,0,4,50,0,100,100,89,3,0,0,0,0,0,5,51,0,100 ,100,0,0,0,0,0,0,0,7,15,0,81,60,138,198,225,8,0,0,0,9,50,0,97,97,161,10,0,0,0,0,0,10,19,0,100,1 00,0, 0,0,0,0,0,0,12,50,0,100,100,103,3,0,0,0,0,0,187,50,0,100,100,0,0,0,0,0,0,0,189,58,0,100,100,0,0 ,0,0, 0,0,0,190,34,0,56,47, 44 ,0,19,49,0,0,0,191,50,0,100,100,0,0,0,0,0,0,0,192,50,0,100,100,28,2,0,0,0,0,0,193,34,0,68,68,15 4 ,0,1,0,0,0,0,194,26,0, 44 ,53, 44 ,0,0,0,15,0,0,195,18,0,64,57,245,185,11,13,0,0,0,197,16,0,100,100,0,0,0,0,0,0,0,198,62,0,100,10 0 ,0,0,0,0,0,0,0,199,0,0,200,200,0,0,0,0,0,0,0,200,50,0,100,253,0,0,0,0,0,0,0,202,0,0,100,253,0,0 ,0,0, 0,0,0,254,0,0,100,253,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0 VendorSpecific2: 0 VendorSpecific3: 105 VendorSpecific4: 0,0,0,0,7,2,2,2,2,2,2,2,2,0,0,0,0,0,0,0,0,1,0,0,0,0,105,6,0,0,1,0,12,44,81,238,41,1,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,1,0,0,0,0,0,0,0,37,148,136,228,1,0,0,0,194,141,44,2,0,0,0,0 ,0,0, 0,0,0,0,183,10,5,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 UEZ Edited March 11, 2009 by UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
James Posted March 11, 2009 Author Posted March 11, 2009 127, 173 and 175 all return different results. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ
James Posted March 11, 2009 Author Posted March 11, 2009 I have compared my result from 115 with a professional tool, turns out my correct value comes from 139 which is a popular number from what I have seen. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now