Darktan Posted September 25, 2008 Posted September 25, 2008 I have a script that will have to temporarily map a network drive to share, copy a file and then disconnect. Since this could be run on any number of users I have to guess at their mappings. DriveMapAdd will let me use the '*' for the next available drive, but then I need to know what that drive is. After a successful mapping, both @error and @extended return '0' as values. CODEDriveMapAdd("X:", "\\myserver\stuff") $MAPDRV=@extended MsgBox(4096,@error, "Drive mapped as: "&$MAPDRV) I'm running version 3.2.12.0. Anyone have any ideas why this is giving me empty values? Peace --Darktan
PsaltyDS Posted September 25, 2008 Posted September 25, 2008 I have a script that will have to temporarily map a network drive to share, copy a file and then disconnect. Since this could be run on any number of users I have to guess at their mappings. DriveMapAdd will let me use the '*' for the next available drive, but then I need to know what that drive is. After a successful mapping, both @error and @extended return '0' as values. DriveMapAdd("X:", "\\myserver\stuff") $MAPDRV=@extended MsgBox(4096,@error, "Drive mapped as: "&$MAPDRV) I'm running version 3.2.12.0. Anyone have any ideas why this is giving me empty values? Peace --Darktan First, if you want DriveMapAdd() to pick the drive letter, don't specify "X:". Second, you need to capture the return value to a variable. $sMapping = DriveMapAdd("*", "\\myserver\stuff") $iErrSav = @error $iExtSav = @extended MsgBox(4096,"Results", "@error = " & $iErrSav & @CRLF & _ "@extended = " & $iExtSav & @CRLF & _ "Drive mapped as: " & $sMapping) 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
Darktan Posted September 25, 2008 Author Posted September 25, 2008 First, if you want DriveMapAdd() to pick the drive letter, don't specify "X:". Second, you need to capture the return value to a variable. $sMapping = DriveMapAdd("*", "\\myserver\stuff") $iErrSav = @error $iExtSav = @extended MsgBox(4096,"Results", "@error = " & $iErrSav & @CRLF & _ "@extended = " & $iExtSav & @CRLF & _ "Drive mapped as: " & $sMapping) Thanks PsaltyDS. That did it. I needed the $sMapping to get it to work. And I have the '*'. That was a miss copy. The gas station didn't have my Mountain Dew this morning. How rude.
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