Jump to content

Hard Drive Status Light


mbkowns
 Share

Recommended Posts

I want to make a simple hard drive status light that uses scroll lock on and off and maybe a system tray icon. The code for that part should be really easy i just need a way to detect the hard drive is ticking away.

What should I use for finding out the hard drive activity?

If HDinuse then

SEND ("{SCROLLLOCK on}")

SEND ("{SCROLLLOCK off}")

Endif

thanks

Link to comment
Share on other sites

  • Moderators

The code for that part should be really easy i just need a way to detect the hard drive is ticking away.

What should I use for finding out the hard drive activity?

Well, if your script is working, that's a good indication.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

I don't want to detect if my script works I want to detect anything that accesses the hard drive and then make the light on and off in a loop if there is. Like the light on the front of the computer but some don't have one thats why I want to make this. Also would be cool to look at the computer instead..

Link to comment
Share on other sites

  • Moderators

I don't want to detect if my script works I want to detect anything that accesses the hard drive and then make the light on and off in a loop if there is. Like the light on the front of the computer but some don't have one thats why I want to make this. Also would be cool to look at the computer instead..

Yeah, I understand what you're saying... but... you certainly aren't being specific enough.

You could run the ProcessList() store in a string in a Var and compare the New ProcessList() every so often to that var to see if new Process are running... there are also WMI scripts out there to measure CPU usage (I think PsaltyDS wrote one as well, and weaponx may have did a graphic chart on it) that if it increases above a specific range you could turn your light on etc... Then you could use different icons for the system tray I suppose depending on usage.

But I don't think anyone is going to write it for you if that's what your asking...

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

How about something like this? I don't think you want to monitor real disk access, because it's in use every second.

$objWMIService = ObjGet("winmgmts:{impersonationLevel=impersonate}\\.\root\cimv2")
While 1
    $WMIQuery = $objWMIService.ExecQuery ("SELECT * FROM Win32_PerfFormattedData_PerfDisk_PhysicalDisk WHERE Name = '_Total'")
    For $obj In $WMIQuery
        If $obj.PercentDiskTime = 0 Then
            Send("{SCROLLLOCK OFF}")
        Else
            Send("{SCROLLLOCK ON}")
        EndIf
    Next
    Sleep(150)
WEnd
Link to comment
Share on other sites

How about something like this? I don't think you want to monitor real disk access, because it's in use every second.

$objWMIService = ObjGet("winmgmts:{impersonationLevel=impersonate}\\.\root\cimv2")
While 1
    $WMIQuery = $objWMIService.ExecQuery ("SELECT * FROM Win32_PerfFormattedData_PerfDisk_PhysicalDisk WHERE Name = '_Total'")
    For $obj In $WMIQuery
        If $obj.PercentDiskTime = 0 Then
            Send("{SCROLLLOCK OFF}")
        Else
            Send("{SCROLLLOCK ON}")
        EndIf
    Next
    Sleep(150)
WEnd

I knew it was going to be using WMI I just didn't know which one I should use. I think this will get me in the right direction.

It stays off for me also. Need to see what this WMI call is and see what I can do differently

Link to comment
Share on other sites

How about something like this? I don't think you want to monitor real disk access, because it's in use every second.

What if I set it so reads the light stays on and writes is stays off. I think this way it would flash on and off based on usage instead of some counter or sleep that I insert in the code.

Link to comment
Share on other sites

Nothing to do with Autoit, but the diskmon utility from microsoft gives you a disk "light" in the tray when minimised - red for write, green for read

see here

I know there are programs out there that do this already and I could just use one of those. I want to make my own code and this should be easier then it is seeming to be so far.

I know I need to use WMI and I am tryin to figure out which function in there I should use. The scroll lock on and off part is easy. I want it to work in sync with the hard drive light also and I know its possible because I have used those programs that people have made and theres sync exactly with the hard drive light. They also mention using WMI so I know I am diggin in the right spot.

Link to comment
Share on other sites

  • Moderators

I know there are programs out there that do this already and I could just use one of those. I want to make my own code and this should be easier then it is seeming to be so far.

I know I need to use WMI and I am tryin to figure out which function in there I should use. The scroll lock on and off part is easy. I want it to work in sync with the hard drive light also and I know its possible because I have used those programs that people have made and theres sync exactly with the hard drive light. They also mention using WMI so I know I am diggin in the right spot.

I'm curious...

Stepping outside of AutoIt for a moment... What code did google give you from other languages? It's obvious that no one either knows really what you want, or knows how to do it... Code that actually does what you want regardless of the language may be easily translated into working AutoIt code.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

I'm curious...

Stepping outside of AutoIt for a moment... What code did google give you from other languages? It's obvious that no one either knows really what you want, or knows how to do it... Code that actually does what you want regardless of the language may be easily translated into working AutoIt code.

I didn't find the code only references that it used WMI which really makes sense. Anyway I did figure out how this works and here is my code for it below. I could of just downloaded one of the apps online that worked but I wanted to make one that would just run on double click and I could close it when I was done with it. Instead of installing the app on a machine everytime to find out about the activity...

$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)
                
                
    For $obj In $WMIQuery 
        
        If  $obj.DiskReadsPersec > $val Then
            $val = $obj.DiskReadsPersec
           
            Send("{SCROLLLOCK ON}")
        Else
            Send("{SCROLLLOCK OFF}")
        EndIf
        
        If  $obj.DiskWritesPersec > $val Then
            $val = $obj.DiskWritesPersec
           
            Send("{SCROLLLOCK ON}")
        Else
            Send("{SCROLLLOCK OFF}")
        EndIf
    Next
    Sleep(150)
WEnd
Link to comment
Share on other sites

I'm pretty sure flipping the scroll lock key without hooking it somehow will cause some apps to freak out. You would be better off putting a status indicator in the system tray.

What do you mean hooking it? I am also going to have a systray icon. There are apps online that use the scroll lock and don't seem to mess up programs and also sell for 20 bucks online.

Link to comment
Share on other sites

I'm going to have to go with Wikipedia on this one...you may be able to get away with this for typical windows usage.

http://en.wikipedia.org/wiki/Scroll_lock

In the game WWE Raw 2, the Scroll Lock key is used to whilst playing as Trish Stratus to deliver a devastating slap to an opponent.

You start flashing that scroll lock key and your opponents will pay dearly, and often.

Heres another fun one:

In Windows NT-based operating systems with a certain registry setting called "CrashOnCtrlScroll" is enabled, double tapping Scroll Lock while holding Ctrl key initiates a system crash to allow debugging the current state of the operating system

Link to comment
Share on other sites

I'm going to have to go with Wikipedia on this one...you may be able to get away with this for typical windows usage.

http://en.wikipedia.org/wiki/Scroll_lock

You start flashing that scroll lock key and your opponents will pay dearly, and often.

Heres another fun one:

Okay I follow what your saying but how is it that other people who made a similar program not have issues with those programs.

Did they use a hook like you mentioned ?

What could I do to prevent this?

I also plan on having it change the tray icon I am just looking for one I like right now but I want the scroll lock to also work.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...