Jump to content
Sign in to follow this  
dash007

Progressbar showing DriveSize

Recommended Posts

dash007

Hi, does anyone know of a script on how to get a gui (progressbar) that reads the size of the harddrive. Thanks in advance

Share this post


Link to post
Share on other sites
CyberSlug

Maybe something like this:

#include <GuiConstants.au3>

$total = DriveSpaceTotal("C:")
$free = DriveSpaceFree("C:")
$used = $total - $free

GuiCreate("C: drive:  " & Round($total/1024,2) & " GB total ", 400, 100)
$progress = GuiCtrlCreateProgress(20, 20, 300, 30)

GuiCtrlSetData($progress,  100 * $used / DriveSpaceTotal("C:"))

GuiCtrlCreateLabel(Round($used/1024,2) & " GB used ", 70, 70)
GuiCtrlCreateLabel(Round($free/1024,2) & " GB free ", 230, 70)

GuiSetState()
While GuiGetMsg() <> $GUI_EVENT_CLOSE
WEnd

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!

Share this post


Link to post
Share on other sites
dash007

CyberSlug,

Brilliant! I worship you!

Share this post


Link to post
Share on other sites
Ejoc

So I started tinkering. I made a version that monitors Drives, changes bar color based on % of fullness, and also handles flash drives.

Select multiple drives by seperating w/ a ',' ie: C:,D:,F:,N:

Configure and Exit by right-click in the window(this is buggy you need to select an area w/o label or progress bar, I use upper left corner)

Disk_Monitor.zip

Edited by Ejoc

Start -> Programs -> AutoIt v3 -> AutoIt Help File -> Index -> (The Function you are asking about)----- Links -----DllStruct UDFsRSA Crypto UDFs

Share this post


Link to post
Share on other sites
dash007

Ejoc,

Very impressive. I like the interface!

Share this post


Link to post
Share on other sites
Smed

Yah.. thats pretty sweet. Suggestion: make it scan drive letters, say once every 30 seconds or so to enumerate drives. I have 8 or more network drives at any given time and they change regularly. Yes, I know I'm abnormal. Just sayin'


601DisengageEnd Program

Share this post


Link to post
Share on other sites
Ejoc

Made a small addition, added an Update field so you can slow down how often it checks your drives, default is now every 30 seconds.

I havent added the auto scanning, as it wont be super easy. The gui is built on how many drives you are watch, so if the number of drives is adjusting then I would need to rebuild the gui, not impossible but I'm lazy atm :)

EDIT

Also its really inteded to be run form the .exe, as it will restart itself when you configure it, running the .au3 requires a manual restart.

Edited by Ejoc

Start -> Programs -> AutoIt v3 -> AutoIt Help File -> Index -> (The Function you are asking about)----- Links -----DllStruct UDFsRSA Crypto UDFs

Share this post


Link to post
Share on other sites
SlimShady

running the .au3 requires a manual restart.

<{POST_SNAPBACK}>

Here's a trick.

If NOT $CmdLine[0] Then
   MsgBox(64, "Test", "Script will now restart...")
   If @Compiled Then
      Run(@ScriptFullPath & " restart")
   Else
      Run(@AutoItExe & ' "' & @ScriptFullPath & '" restart')
   EndIf
Else
   MsgBox(64, "Test", "Script has restarted itself succesfully!")
EndIf

Share this post


Link to post
Share on other sites
Ejoc

Thanks SlimShady

That plus a better config window have been added

Post w/ File Or go up some :)

Edited by Ejoc

Start -> Programs -> AutoIt v3 -> AutoIt Help File -> Index -> (The Function you are asking about)----- Links -----DllStruct UDFsRSA Crypto UDFs

Share this post


Link to post
Share on other sites
Smed

Since this has now been asked in another thread, here's a quick and dirty drive enumerator:

Func EnumerateDrives ()
  $szDrivestr = "C:\"
  For $dl = 68 To 93
    $drive = chr ($dl) & ":\"
    DriveGetFileSystem ($drive)
    If @error = 0 Then $szDrivestr = $szDrivestr & "," & $drive
  Next
EndFunc

Yes, I know not everybody has a C drive, but I really don't care. :)


601DisengageEnd Program

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.