Jump to content

Recommended Posts

Posted (edited)

I suppose you could try something like this

#include <GUIConstants.au3>

$Drives=DriveGetDrive("ALL")

Dim $Labels[$Drives[0]+1]
Dim $Progress[$Drives[0]+1]
$Form1 = GUICreate("Form1", 225,20+ $Drives[0]*25, 195, 136)

For $i=1 To $Drives[0]
    $Labels[$i]=GUICtrlCreateLabel(StringUpper($Drives[$i]),24,$i*20)
    $Progress[$i] = GUICtrlCreateProgress(80, $i*20, 121, 17)
Next
GUISetState(@SW_SHOW)


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd
Edited by Nahuel
Posted

Erm.. How would I go about setting each progress?

#include <GUIConstants.au3>

Global $Drives = DriveGetDrive("FIXED")
Dim $Labels[$Drives[0] + 1]
Dim $Progress[$Drives[0] + 1]

DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", 0)

$GUI = GUICreate("Drive Percentages", 225, $Drives[0] * 40, -1, -1)

For $i = 1 To $Drives[0]
    $Labels[$i] = GUICtrlCreateLabel(StringUpper($Drives[$i]), 24, $i * 20)
    $Progress[$i] = GUICtrlCreateProgress(80, $i * 20, 121, 17)
Next

Space()

GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

Func Space()
    ; Space / Total * 100 = Percentage
    For $a = 1 To $Drives[0]
        $Space = DriveSpaceFree($Drives[$a])
        $Total = DriveSpaceTotal($Drives[$a])
        GuiCtrlSetData($Drives[$a], $Space[$a] / $Total[$a] * 100)
    Next
EndFunc

Sorry, I ma having a dumb day :)

Posted

Done!

#include <GUIConstants.au3>

Global $Drives = DriveGetDrive("FIXED")
Dim $Labels[$Drives[0] + 1]
Dim $Progress[$Drives[0] + 1]

DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", 0)

$GUI = GUICreate("Drive Percentages", 225, $Drives[0] * 40, -1, -1)

For $i = 1 To $Drives[0]
    $Labels[$i] = GUICtrlCreateLabel(StringUpper($Drives[$i]), 24, $i * 20)
    $Progress[$i] = GUICtrlCreateProgress(45, $i * 20, 150, 17, 0x1)
    GUICtrlSetColor(-1, 0x00ff00)
    For $a = 1 to $Drives[0]
        $Space = DriveSpaceFree($Drives[$a])
        $Total = DriveSpaceTotal($Drives[$a])
        GuiCtrlSetData($Progress[$a], $Space / $Total * 100)
    Next
Next

GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

Woop!

Posted (edited)

Mmm, like this?

#include <GUIConstants.au3>

Global $Drives = DriveGetDrive("FIXED")
Dim $Labels[$Drives[0] + 1]
Dim $Progress[$Drives[0] + 1]

DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", 0)

$GUI = GUICreate("Drive Percentages", 225, $Drives[0] * 40, -1, -1)

For $i = 1 To $Drives[0]
    $Labels[$i] = GUICtrlCreateLabel(StringUpper($Drives[$i]), 24, $i * 20)
    $Progress[$i] = GUICtrlCreateProgress(80, $i * 20, 121, 17)
Next

Space()

GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

Func Space()
    ; Space / Total * 100 = Percentage
    For $a = 1 To $Drives[0]
        $Space = DriveSpaceFree($Drives[$a])
        $Total = DriveSpaceTotal($Drives[$a])
        GuiCtrlSetData($Progress[$a], 100 - Int(($Space * 100)/ $Total))
         ;100 - Int(($Space * 100)/ $Total)-->Represent full percentage
         ;Int(($Space * 100)/ $Total)-->Represent free percentage
    Next
EndFunc

edit: Yeah. haha you had the variables messed up

Edited by Nahuel
Posted (edited)

This seems pretty elementary for someone with 3300 posts. What gives JamesB?

haha, that's what I thought too but he said he's having a dumb day :)

Edited by Nahuel
Posted

Yeah, I haven't been with it for a while. I am really sorry folks, it's just I have been having a hard time. One of my friends passed away the other day. I have tried to keep myself occupied.

Sorry for your loss. If history has taught us anything, we should judge not by the quantity of ones posts, but by the content of their character.

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
×
×
  • Create New...