nadigo 0 Posted August 7, 2011 Hi, I am trying to get an available drive letter (a one that is not used by local HD, CDROM, network share or any other) during script run time in order to use that Drive letter to mount a file system . I use the DriveGetDrive("ALL") to list the existing disks and eliminate if from Z-A order. I get the letter "Z" even when there is a mounted network share on the dirve ("Z") why ?? Thnaks, Nadav Func GetFreeDriveLatter () $DriveArray = DriveGetDrive("ALL") ;_ArrayDisplay ($DriveArray) Global $AtoZ [27] = ["25","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"] For $i = 26 to 1 Step -1 For $DriveCount = 1 to $DriveArray[0] If StringInStr (($DriveArray[$DriveCount]), $AtoZ[$i], 0) Then $AtoZ[$i] = False Next Next ;_ArrayDisplay ($AtoZ) For $i1 = 26 to 1 Step -1 If $AtoZ[$i1] <> False Then $MountDrive = StringUpper($AtoZ[$i1]) ExitLoop EndIf Next Return ($MountDrive) EndFunc Share this post Link to post Share on other sites
bogQ 91 Posted August 7, 2011 (edited) i think you have some array problem, its mess in there try like this and tellme do the Z have false on msgbox? #Include <Array.au3> MsgBox(0,"",GetFreeDriveLatter()) Func GetFreeDriveLatter () $DriveArray = DriveGetDrive("ALL") $listtemall = "A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z" For $x = 1 To $DriveArray[0] If StringInStr($listtemall,StringReplace($DriveArray[$x],":","")) Then $listtemall = StringReplace($listtemall,StringReplace($DriveArray[$x],":",""),"False") Next Return $listtemall EndFunc Edited August 7, 2011 by bogQ TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)There are those that believe that the perfect heist lies in the preparation.Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost. Share this post Link to post Share on other sites
wakillon 403 Posted August 7, 2011 DriveGetDrive doesn't recognize mounted network. So, if possible (i don't know about mounted network), try to add a condition if drive already exists... AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Share this post Link to post Share on other sites
bogQ 91 Posted August 7, 2011 @wakillon Parameters type Type of drive to find: "ALL", "CDROM", "REMOVABLE", "FIXED", "NETWORK", "RAMDISK", or "UNKNOWN" so it shud detect network drive connected (maped) to PC TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)There are those that believe that the perfect heist lies in the preparation.Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost. Share this post Link to post Share on other sites