HDD Activity Monitoring LED
PS. Don't forget to run "diskperf.exe -y" once to enable the HDD monitoring.
DOWNLOAD HDDMonitor.ahk.
I'm for anything that makes blinky lights.
Thanks
Yes, someone once told me that the keyboard indicator function didn't work with MS natural keyboard. I found it rather ironic, the one which broke their provided functionality was thier own product... but I'm afraid it's not unusual with MS.it doesn't work here.. mayb microsoft natural keyboard...
My original version was using GUI, a small box sitting at the top left corner and changing the background color accordingly. Apparently, however, it seemed not possible to change in real time the background color of AHK's GUI, unless using controls. Instead of digging into it, as I'm usually impatient with GUI stuffs, I chose to use the keyboard indicators. Maybe later, unless someone else does the GUI thing before.
You can always text the text color of statics.Apparently, however, it seemed not possible to change in real time the background color of AHK's GUI, unless using controls.
Oh, I forgot to say about it. There are two '1 << 16' in the script. Just replace 1 with 2 or 4 (or, equivalently, 16 to 17 or 18 leaving 1 as it is).My laptop doesn't have a scroll lock LED. How do you change it so it uses the caps lock or num lock LED instead?
ScrollLock: 1, NumLock: 2, CapsLock: 4You may also combine them like 2+4 etc.
Your script is Nice & Useful.
My original version was using GUI, a small box sitting at the top left corner and changing the background color accordingly. Apparently, however, it seemed not possible to change in real time the background color of AHK's GUI, unless using controls. Instead of digging into it, as I'm usually impatient with GUI stuffs, I chose to use the keyboard indicators. Maybe later, unless someone else does the GUI thing before.
Here is my attempt, just a starter, < 45 lines.
; Posted at http://www.autohotkey.com/forum/viewtopic.php?p=113890#113890 #SingleInstance, Force Process, Priority,, High OnExit, Quit oRC := 0, oWC := 0 ; Run, diskperf.exe -y ; Execute it once to enable Disk Performance monitoring. SetTimer, HDD_Monitor, ;500 hDrv := DllCall( "CreateFile", Str,"\\.\PhysicalDrive0", Uint,0 ,Uint,3, Uint,0, Uint,3 , Uint,0, Uint,0 ) Gui, -Caption +Border +AlwaysOnTop +ToolWindow Gui, Color, EEAA99 Gui, +LastFound WinSet, TransColor, EEAA99 Gui, Add, Progress, w60 h9 cGreen -0x1 vRead Gui, Add, Progress, x+5 w60 h9 cRed -0x1 vWrite Gui, Show, x780 y3 , HDD Monitor ; Adjust X & Y to suit your screen res Return HDD_Monitor: VarSetCapacity(dp, 88) DllCall( "DeviceIoControl", Uint,hDrv, Uint,0x00070020, Uint,0, Uint,0, Uint, &dp , Uint,88, UintP,nReturn, Uint,0 ) nRC := *(&dp+40) | *(&dp+41) << 8 | *(&dp+42) << 16 | *(&dp+43) << 24 nWC := *(&dp+44) | *(&dp+45) << 8 | *(&dp+46) << 16 | *(&dp+47) << 24 RC := Round(100-(100*(1/(1+(nRC-oRC))))) , WC := Round(100-(100*(1/(1+(nWC-oWC))))) GuiControl,, Read , %RC% GuiControl,, Write, %WC% oRC := nRC , oWC := nWC Return Quit: DllCall("CloseHandle", "Uint", hDrv) ExitApp Return
I find your posts more & more useful. Keep up the good work.
Thanks.
Ah, you still didn't learn, Skan.....Here is my attempt, just a starter, < 45 lines.
BTW, very nice gui.
BTW2, I see that you are interested in algorythm performance. DOn't number of lines misslead you, it has not 1 single thing to do with the speed, and its usualy contrary, that longer code is quicker then shorter.
If you are interested in theory, you will have to know differential equations pretty much, (in)finite sums and logarithms. The speed of algorythm can be proved mathematicaly. I have my books about this on Serbian only, but if you want to know more I can find you relevant articles and your guru most definitely can provide some help about the topic 8)
Thanks for this excellent GUI. I knew that you could do it better than me.Here is my attempt, just a starter, < 45 lines.
BTW, you separated the read/write counter. I almost thought that you had a psychic power.
Thanks for the good words.I find your posts more & more useful. Keep up the good work.
Here's another take based on FloatLed
<!-- m -->http://www.softpedia... ... tLED.shtml<!-- m -->
_= 2007 04 03 Ver 1.0.46.10 _= ESC to exit program ! ; add ini to remember last screen pos #NoEnv #Persistent #SingleInstance, Force SetBatchLines, -1 Gui,Color,0x0 Gui -Caption +Owner +AlwaysOnTop Gui,Font,s10 w700, Courier New OnMessage(0x219, "NotifyChange") ;; include code to re-evaluate when ;; hidden drive is activated during ;; Pseudo raid ! /* Run, diskperf.exe -y ; Execute it once to enable Disk Performance monitoring. Not required for Xp + In Windows 2000 this IOCTL is handled by the filter driver diskperf. In Windows XP and later operating systems, the partition manager handles this request for disks and ftdisk.sys and dmio.sys handle this request for volumes. */ SetTimer,ScanDrv,50 _= Enumerate Available Drives (Fixed) DriveGet,aDrives,List,FIXED Loop,Parse,aDrives { DrvCount ++ Drv%A_Index% := a_Loopfield CurDrv:= "\\.\" Drv%A_Index% ":" hDrv%A_Index% := DllCall("CreateFile",Str,CurDrv,Uint,0,Uint,3,Uint,0,Uint,3,Uint,0,Uint,0) } _= Build Quick+Dirty Gui to fit x=2 Loop,% DrvCount { Gui,Add,Text,x%x% y-5 w09 h12 c0x00FF00 vx%A_Index%, Gui,Add,Text,x%x% y6 w09 h12 c0xFFFFFF ,% Drv%A_Index% Gui,Add,Text,x%x% y18 w09 h10 c0xFF8800 vy%A_Index%, x+=17 } x-=8 Gui,Show, x100 y100 w%x% h30 ,win ; WinSet, TransColor,0x0 225 ,win Return GuiEscape: GuiClose: ExitApp Return ScanDrv: SetTimer,ScanDrv,Off Loop,% DrvCount { VarSetCapacity(dp%A_Index%,88) DllCall("DeviceIoControl",Uint,hDrv%A_Index%,Uint,0x00070020,Uint,0,Uint,0 ,Uint,&dp%A_Index%,Uint,88,UintP,nReturn,Uint,0) nReadCount%A_Index% := DecodeInteger(&dp%A_Index% + 40) nWriteCount%A_Index% := DecodeInteger(&dp%A_Index% + 44) _= Case Writing @ y%A_Index% If (nWriteCount%A_Index% <> _nWriteCount_%A_Index%) { _nWriteCount_%A_Index% := nWriteCount%A_Index% GuiControl,,y%A_Index%,= } Else guicontrol,,y%A_Index%, _= Case Reading @ x%A_Index% If (nReadCount%A_Index% <> _nReadCount_%A_Index%) { _nReadCount_%A_Index% := nReadCount%A_Index% GuiControl,,x%A_Index%,= } Else guicontrol,,x%A_Index%, } SetTimer,ScanDrv,On Return DecodeInteger(ptr) { Return *ptr | *++ptr << 8 | *++ptr << 16 | *++ptr << 24 } ~LButton::DragGui("win") _========================================================================= _== FUNCTION : DragGui(WinTitle) == _== Author : Chris Mallett == _== Updated : Converted to FUNCTION By Dave Perrée Jun 2006 == _== Usage : ~LButton::DragScreen("WinTitle") == _========================================================================= DragGui(_WinTitlePart) { STATIC _GuiID,_MouseStartX,_MouseStartY WinGet,_GuiID, ID,% _WinTitlePart CoordMode,Mouse MouseGetPos,_MouseStartX,_MouseStartY,_MouseWin If _MouseWin <> %_GuiID% Return SetTimer,_WatchMouse,5 Return _WatchMouse: GetKeyState,_LButtonState,LButton,P If _LButtonState=U { SetTimer,_WatchMouse,Off Return } CoordMode,Mouse MouseGetPos,_MouseX,_MouseY _DeltaX:=_MouseX _DeltaX-=%_MouseStartX% _DeltaY:=_MouseY _DeltaY-=%_MouseStartY% _MouseStartX:=_MouseX _MouseStartY:=_MouseY WinGetPos,_GuiX,_GuiY,,,ahk_id%_GuiID% _GuiX+=%_DeltaX% _GuiY+=%_DeltaY% SetWinDelay,-1 WinMove,ahk_id %_GuiID%,,%_GuiX%,%_GuiY% RETURN } NotifyChange() { ; do nothing yet Return }
Have Fun
Nice. BTW, there seems to be a confusion in the comment. I don't think diskperf.exe has anything to do with diskperf.sys which is indeed missing in XP. diskperf.exe controls the enableness of the corresponding counter. To see this, execute diskperf -n. So, it's still needed in XP.Here's another take based on FloatLed
Ah, you still didn't learn, Skan.....
IMHO, the beauty of AHK is lies in the fact that one can write really short ( ( I refer to the lines ) & yet powerful scripts. Ofcourse, techies like you and others have pointed out the various limitations of the language. Still, I admire AHK very much mainly for its simple syntax and the powerful GUI capabilities. I am glad that I do not have to be a powerful programmer to use AHK.
BTW, very nice gui.
Thanks
@Sean
Thanks for this excellent GUI. I knew that you could do it better than me.
BTW, you separated the read/write counter. I almost thought that you had a psychic power.
Thanks
@Dippy46 : Re. DragGui()
Nice script Sir . BTW, The drag can be enabled for a captionless GUI with a simple postmessage. Example:
Gui, -Caption +ToolWindow +0x400000 Gui, Font, S14 Bold, Verdana Gui, Add, Text, w200 h27 Border Center GuiMove, Click Here `&& Drag Gui, Show, AutoSize Return uiMove: [color=red]PostMessage, 0xA1, 2,,, A [/color] Return GuiEscape: Exitapp
Example taken from: How to enable Drag for a GUI without a Titlebar ?