-
Notifications
You must be signed in to change notification settings - Fork 72
/
Copy pathhwmonitor.ahk
62 lines (54 loc) · 1.49 KB
/
hwmonitor.ahk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
GetCPUClock() {
return GetSensorValue("CPU Core", "Clock")
}
GetGPUClock() {
return GetSensorValue("GPU Core", "Clock")
}
GetCPULoad() {
return GetSensorValue("CPU Total", "Load")
}
GetGPULoad() {
return GetSensorValue("GPU Core", "Load")
}
GetCPUTemp() {
temperature := GetSensorValue("CPU Package", "Temperature")
if temperature
return temperature
return GetSensorValue("CPU Core", "Temperature")
}
GetGPUTemp() {
return GetSensorValue("GPU Core", "Temperature")
}
; ListSensors("gpu")
; GetSensorValue("CPU Package", "Temperature")
; Available types: Load Temperature Voltage Power Clock Data SmallData Control Factor Fan Level
GetSensorValue(name, type)
{
objItem:=ComObjGet("winmgmts:\\.\root\OpenHardwareMonitor").ExecQuery("select * from Sensor where SensorType = '" type "' and Name = '" name "'")
if objItem.Count() < 1
{
return
}
for item in objItem
{
name := item.name
value := item.value
return value
}
}
; list in powershell:
; get-wmiobject -namespace root\OpenHardwareMonitor -query 'select * from Sensor' | select name, value, sensortype, parent | sort sensortype
ListSensors(filter)
{
s := ""
for objItem in ComObjGet("winmgmts:\\.\root\OpenHardwareMonitor").ExecQuery("SELECT * FROM Sensor")
{
name := objItem.Name
IfInString, name, %filter%
{
s .= objItem.Name " (" objItem.SensorType "): " objItem.Value "`n"
}
}
MsgBox, %s%
}