AmphetaMarinE Posted September 18, 2007 Share Posted September 18, 2007 Hi, I am absolutely stuck here... How might I go about listing all available drive letters on a PC? I want to put them into a combobox to enable choosing of an available (unused) drive letter for mapping a path to.... Completely stumped hey.... Thanks for any ideas, Amph. Link to comment Share on other sites More sharing options...
Zedna Posted September 18, 2007 Share Posted September 18, 2007 DriveGetDrive() Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
AmphetaMarinE Posted September 18, 2007 Author Share Posted September 18, 2007 DriveGetDrive()Thanks Zedna, at least I know I'm on the right track...I have been trying by using DriveGetDrive("all")But that returns currently assigned drive letters...I am stuck trying to return all unassigned driveletters...I am quite new to all things programming, including autoit scripting...Not saying I need someone to do the work for me, just a nudge in the right direction.... Link to comment Share on other sites More sharing options...
Danny35d Posted September 18, 2007 Share Posted September 18, 2007 Try this one: #include <Array.au3> $FreeDriveList = _GetFreeDriveLetters() _ArrayDisplay($FreeDriveList) Func _GetFreeDriveLetters() Dim $aArray[1] For $x = 67 To 90 If DriveStatus(Chr($x) & ':\') = 'INVALID' Then ReDim $aArray[UBound($aArray) + 1] $aArray[UBound($aArray) - 1] = Chr($x) & ':' EndIf Next $aArray[0] = UBound($aArray) - 1 Return($aArray) EndFunc AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line Link to comment Share on other sites More sharing options...
AmphetaMarinE Posted September 18, 2007 Author Share Posted September 18, 2007 Try this one: #include <Array.au3> $FreeDriveList = _GetFreeDriveLetters() _ArrayDisplay($FreeDriveList) Func _GetFreeDriveLetters() Dim $aArray[1] For $x = 67 To 90 If DriveStatus(Chr($x) & ':\') = 'INVALID' Then ReDim $aArray[UBound($aArray) + 1] $aArray[UBound($aArray) - 1] = Chr($x) & ':' EndIf Next $aArray[0] = UBound($aArray) - 1 Return($aArray) EndFunc Ahhh now that works perfectly Danny35d Thanks a million for that one! Could I trouble you for one last question though? What do the numbers represent in this line? For $x = 67 To 90 I found I can change them and drives below C: are then listed, but I am unsure how you know which numbers to use, and what they actually represent... Thanks again, Amph. Link to comment Share on other sites More sharing options...
Danny35d Posted September 18, 2007 Share Posted September 18, 2007 (edited) For $x = 67 To 90 I found I can change them and drives below C: are then listed, but I am unsure how you know which numbers to use, and what they actually represent... Thanks again, Amph.Look at the if statement Im using Chr() function which return a character corresponding to an ASCII code. In the ASCII table 67 is equal to upper case C and 90 is equal to upper case Z. If you want to start in D and over change 67 to a 68. Note fix some typo Edited September 18, 2007 by Danny35d AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line Link to comment Share on other sites More sharing options...
AmphetaMarinE Posted September 18, 2007 Author Share Posted September 18, 2007 Look at the if statement Im using Chr() function which return a character corresponding to an ASCII code. In the ASCII table 67 is equal to upper case B and 90 is equal to upper case Z.Ahhh thanks so much for the explanation.Now I can see how it all works Cheers,Amph. 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