James Posted December 22, 2007 Share Posted December 22, 2007 Hey all, I was wandering if anyone could help me. I need to find the amount of fixed drives, then create as many progress as there are drives. I then need to add a label above the progress with the drive name and letter. Any ideas? I know it will need a For Next Loop but I am not sure how. Thankyou, James Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
Nahuel Posted December 22, 2007 Share Posted December 22, 2007 (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 December 22, 2007 by Nahuel Link to comment Share on other sites More sharing options...
James Posted December 22, 2007 Author Share Posted December 22, 2007 Ahh brilliant Thanks Nahuel! Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
Nahuel Posted December 22, 2007 Share Posted December 22, 2007 haha, no problem! I just made a slight modification. If you have less than 2 drives it looked cut off Link to comment Share on other sites More sharing options...
James Posted December 22, 2007 Author Share Posted December 22, 2007 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 Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
James Posted December 22, 2007 Author Share Posted December 22, 2007 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! Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
Nahuel Posted December 22, 2007 Share Posted December 22, 2007 (edited) Mmm, like this? expandcollapse popup#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 December 22, 2007 by Nahuel Link to comment Share on other sites More sharing options...
weaponx Posted December 22, 2007 Share Posted December 22, 2007 This seems pretty elementary for someone with 3300 posts. What gives JamesB? Link to comment Share on other sites More sharing options...
Nahuel Posted December 22, 2007 Share Posted December 22, 2007 (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 December 22, 2007 by Nahuel Link to comment Share on other sites More sharing options...
James Posted December 22, 2007 Author Share Posted December 22, 2007 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. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
weaponx Posted December 22, 2007 Share Posted December 22, 2007 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. Link to comment Share on other sites More sharing options...
James Posted December 22, 2007 Author Share Posted December 22, 2007 Thankyou, one of my longest friends as well. Defintley personallity pays us dearly. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
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