roadrunner Posted March 11, 2005 Posted March 11, 2005 Hi It's a simple problem if you know the answer, all I want to do is find out how much free space is available on each drive and store this in a array the the drive letter so I can use it later on in the scripe, my attempts have failed, any help would be much welcome. Here is my attempt #include <Array.au3> $var = DriveGetDrive( "fixed" ) If NOT @error Then MsgBox(4096,"", "Found " & $var[0] & " drives") $test = 1 ;tell the array how many enter to expect Dim $avArray$var[0] For $i = 1 to $var[0] if $var[$i] = "a:" then $i = $i + 1 endif $drive = $var[$i] ; rounds the free space up to a better looking number and assigns it to the variable $tt $tt = round(DriveSpaceFree($drive)) ;just shows a meesage box eith the drive letter and free space on it msgbox(4096,"",$drive &" size " & $tt &" MB") $test1 = $drive &" size " & $tt &" MB" _ArrayAdd( $avArray[$test], & $test1) ;$avarray = $drive &" size " & $tt &" MB" $test = $test + 1 _ArrayDisplay( $avArray, "Whole array" ) Else Next endif
Blue_Drache Posted March 11, 2005 Posted March 11, 2005 Hi It's a simple problem if you know the answer, all I want to do is find out how much free space is available on each drive and store this in a array the the drive letter so I can use it later on in the scripe, my attempts have failed, any help would be much welcome....First off: code /code tags. Second, there's probably an error in this line: Dim $avArray$var[0]try changing the second $ to an _ or something. Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache
phillip123adams Posted March 13, 2005 Posted March 13, 2005 Hi It's a simple problem if you know the answer, all I want to do is find out how much free space is available on each drive and store this in a array the the drive letter so I can use it later on in the scripe, my attempts have failed, any help would be much welcome.<{POST_SNAPBACK}>In case you did not resolve this problem, here's you script in a working state. I commented what is not needed and what was incorrect with ";xxx" for your reference. Could I recommend the use of the SciTE editor from http://www.autoitscript.com/autoit3/scite/downloads.php. It would have pointed out the problem with the Next and Else statements being out of order.expandcollapse popup#include <array.au3> $var = DriveGetDrive( "fixed") If Not @error Then MsgBox(4096, "", "Found " & $var[0] & " drives") ;xxx $test = 1 ;xxx ;tell the array how many enter to expect ;xxx Dim $avArray$var[0] ; Since _ArrayAdd is being used, just dimension $avArray with 1 element ; because _ArrayAdd will expand the array each time it is called. Global $avArray[1] For $i = 1 To $var[0] If $var[$i] = "a:" Then $i = $i + 1 EndIf $drive = $var[$i] ; rounds the free space up, for this drive, to a better looking number and assigns it to the variable $tt $tt = Round(DriveSpaceFree($drive)) ;just shows a meesage box with the drive letter and free space on it MsgBox(4096, "", $drive & " size " & $tt & " MB") $test1 = $drive & " size " & $tt & " MB" ;xxx _ArrayAdd($avArray[$test], $test1) ; include this drive in the array _ArrayAdd($avArray, $test1) ;xxx ;$avarray = $drive &" size " & $tt &" MB" ;xxx $test = $test + 1 _ArrayDisplay($avArray, "Whole array") ;xxx Else ;xxx Next Next ;xxx Else;;??? will anything for ELSE be needed? If not, it is not needed. EndIf Phillip
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