JackMac4 Posted January 8, 2010 Share Posted January 8, 2010 I've found plenty of threads and discussions pertaining to functions related to working with lists of available drives, but what I need is a list of all other drives. I presume I could accomplish this by iterating through the alphabet and comparing the results to a list of DriveGetDrive("all"), but it seems awefully cumbersome. Is there a better method someone could suggest? I need to find 10 available drive letters and fill an array with those results in order to do some mapping. Thanks in advance! Link to comment Share on other sites More sharing options...
PsaltyDS Posted January 8, 2010 Share Posted January 8, 2010 There's a registry entry with a binary bit set for each use drive letter. It's not hard to find and that is left to the student as an exercise. You could also just parse the results of DriveGetDrive(). Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
darkjohn20 Posted January 9, 2010 Share Posted January 9, 2010 (edited) $Drives = DriveGetDrive("ALL") $Drive_String = StringUpper(StringReplace(FormatToString($Drives), ":", "")) $Unused_Drives = StringReplace("ABCDEFGHIJKLMNOPQRSTUVWXYZ", $Drive_String, "") MsgBox(0, "Unused:", $Unused_Drives) Func FormatToString($Drives) $String = "" For $D = 1 To $Drives[0] $String &= $Drives[$D] Next Return $String EndFunc This: Gets all drives Turns the array into a single string removes ":" from the drives removes the found drives from a list of a-z Edited January 9, 2010 by darkjohn20 Link to comment Share on other sites More sharing options...
darkjohn20 Posted January 9, 2010 Share Posted January 9, 2010 To get 10 available ones, use stringleft or stringright to get 10 letters, and then string split by "". Take each of those and do something. Link to comment Share on other sites More sharing options...
GEOSoft Posted January 9, 2010 Share Posted January 9, 2010 Or just as simple $UnusedDrives = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" $Drives = DriveGetDrive("All") For $i = 1 To Ubound($Drives) -1 $sCurrent = StringLeft($Drives[$i], 1) $UnusedDrives = StringReplace($UnusedDrives, $sCurrent, "") Next MsgBox(0, "Result", $UnusedDrives) George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
darkjohn20 Posted January 9, 2010 Share Posted January 9, 2010 That works too, I just don't like working with arrays all the time. For me it is easier to convert to a string and use that string instead of having multiple loops sometimes. Link to comment Share on other sites More sharing options...
GEOSoft Posted January 9, 2010 Share Posted January 9, 2010 That works too, I just don't like working with arrays all the time. For me it is easier to convert to a string and use that string instead of having multiple loops sometimes.No matter how you slice and dice it, when you use driveGetDrive() you still need to go through the array, either with your function or _ArrayToString() George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
darkjohn20 Posted January 9, 2010 Share Posted January 9, 2010 I know, I just prefer not using a lot of ubounds to read from arrays. I'd rather get it to a string and not deal with arrays. By the way, I didn't know there was an array to string function. I kind of just made my own. Link to comment Share on other sites More sharing options...
GEOSoft Posted January 9, 2010 Share Posted January 9, 2010 I know, I just prefer not using a lot of ubounds to read from arrays. I'd rather get it to a string and not deal with arrays. By the way, I didn't know there was an array to string function. I kind of just made my own.Should get used to Ubound(). I would like to see all arrays 0 based at some point in time. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" 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