AmphetaMarinE 0 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. Share this post Link to post Share on other sites
Zedna 288 Posted September 18, 2007 DriveGetDrive() Resources UDF ResourcesEx UDF AutoIt Forum Search Share this post Link to post Share on other sites
AmphetaMarinE 0 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.... Share this post Link to post Share on other sites
Danny35d 15 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 Share this post Link to post Share on other sites
AmphetaMarinE 0 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. Share this post Link to post Share on other sites
Danny35d 15 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 Share this post Link to post Share on other sites
AmphetaMarinE 0 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. Share this post Link to post Share on other sites