firestrife23 Posted April 18, 2011 Share Posted April 18, 2011 (edited) I'm trying to get my script to determine free drive letter and automatically map the drive. For some reason DriveMapAdd dislike the variable "$SetDrive" unless I set it to something else like "G:" #include <Array.au3> $FreeDriveList = GetFreeDriveLetters() $AvailableDrive = _ArrayMin($FreeDriveList) $SetDrive = $AvailableDrive $Map = DriveMapAdd ( $SetDrive, "\\192.168.16.5\Dropbox", 0, "domain\user", "password") $ErrSav = @Error $ExtSav = @Extended MsgBox(64, "Debug", "Results of DriveMapAdd:" & @CRLF & "Return = " & $map & @CRLF & "Error = " & $ErrSav & @CRLF & "Extended = " & $ExtSav) 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 Edited April 18, 2011 by firestrife23 Link to comment Share on other sites More sharing options...
hannes08 Posted April 18, 2011 Share Posted April 18, 2011 Hi firestrife, tested it an d works fine for me. If I display the array I get a list of G: or J: or X: So this should be fine. Even if I just assign the return from _ArrayMin to $SetDrive it works fine. Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler] Link to comment Share on other sites More sharing options...
firestrife23 Posted April 18, 2011 Author Share Posted April 18, 2011 Thanks for quick response, It turned out I was using incorrect login. 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