weaponx Posted November 8, 2007 Posted November 8, 2007 I used to have a Winamp plugin that would make the CapsLock, ScrollLock, and NumLock into a db meter without effecting their usage. It probably used some kind of keyboard hook so the commands weren't caught by the OS...http://www.winamp.com/plugins/details/108744
Lakes Posted May 29, 2012 Posted May 29, 2012 Old thread I know, but is it possible to do this and add the drive letter to the output?$wbemFlagReturnImmediately = 0x10 $wbemFlagForwardOnly = 0x20 $strComputer = "localhost" $Output="" $val = "" $Output = $Output & "Computer: " & $strComputer & @CRLF $Output = $Output & "==========================================" & @CRLF $objWMIService = ObjGet("winmgmts:" & $strComputer & "rootCIMV2") While 1 $WMIQuery = $objWMIService.ExecQuery("SELECT * FROM Win32_PerfRawData_PerfDisk_PhysicalDisk", "WQL", _ $wbemFlagReturnImmediately + $wbemFlagForwardOnly) For $obj In $WMIQuery If $obj.DiskReadsPersec > $val Then $val = $obj.DiskReadsPersec ConsoleWrite("LED ON"&@CR) Else ConsoleWrite("LED OFF"&@CR) EndIf If $obj.DiskWritesPersec > $val Then $val = $obj.DiskWritesPersec ConsoleWrite("LED ON" &@CR) Else ConsoleWrite("LED OFF"&@CR) EndIf Next Sleep(150) WEndSo that you end up with ConDoffEoffFon or C1D0E0F1 as a string output? 2015 - Still no flying cars, instead blankets with sleeves.
Tankbuster Posted May 31, 2012 Posted May 31, 2012 Is this what you expected? $wbemFlagReturnImmediately = 0x10 $wbemFlagForwardOnly = 0x20 $strComputer = "localhost" $Output="" $val = "" $Output = $Output & "Computer: " & $strComputer & @CRLF $Output = $Output & "==========================================" & @CRLF $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2") While 1 $WMIQuery = $objWMIService.ExecQuery("SELECT * FROM Win32_PerfRawData_PerfDisk_PhysicalDisk", "WQL", _ $wbemFlagReturnImmediately + $wbemFlagForwardOnly) $Output="" For $obj In $WMIQuery if StringInStr($obj.Name,"_Total")=0 then If $obj.DiskReadsPersec > $val or $obj.DiskWritesPersec > $val Then $val = $obj.DiskReadsPersec ConsoleWrite($obj.Name&"LED ON"&@CR) $Output=$Output&stringright($obj.Name,2)&"on#" Else ConsoleWrite($obj.Name&"LED OFF"&@CR) $Output=$Output&stringright($obj.Name,2)&"off#" EndIf endif Next ConsoleWrite($Output&@CR) Sleep(150) WEnd output on console: 0 C:LED ON 1 D:LED OFF C:on#D:off# 0 C:LED OFF 1 D:LED OFF C:off#D:off# 0 C:LED OFF 1 D:LED OFF C:off#D:off# ... ... I think the read and write query works better because in your version you always get two status for read and write but the light is only ON or OFF. And I added something to the output. I also removed _Total from the query, this represents all disks... But even if you do not like my code, watch out for the $obj.Name this will return something like: <DISK ID> <DRIVE LETTER>: Now we both get blamed to reanimate a old thread.....I found out after posting my code, sorry. But I already got my code done.....
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