Sign in to follow this  
Followers 0
milkfish1227

DriveMapAdd() failed for Win2K ONLY ?

5 posts in this topic

Hi,

I am experienced DriveMapAdd() function (with ID/Password) failure for Win2K only. WinXP seems work fine. Does anyone has clue what might happend ?

Thanks,

Dick

Share this post


Link to post
Share on other sites



Could you perhaps add this to your script so they we would know why it is getting an error:

DriveMapAdd(<yourstuffhere>)
If @error then Msgbox(0,"Error Code",@error)

The following error codes mean:

When the function fails (returns 0) @error contains extended information:

1 = Undefined / Other error

2 = Access to the remote share was denied

3 = The device is already assigned

4 = Invalid device name

5 = Invalid remote share

6 = Invalid password

I hope this helps.


"So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire

Share this post


Link to post
Share on other sites

Could you perhaps add this to your script so they we would know why it is getting an error:

DriveMapAdd(<yourstuffhere>)
If @error then Msgbox(0,"Error Code",@error)

The following error codes mean:

When the function fails (returns 0) @error contains extended information:

1 = Undefined / Other error

2 = Access to the remote share was denied

3 = The device is already assigned

4 = Invalid device name

5 = Invalid remote share

6 = Invalid password

I hope this helps.

I havn't figured out what's going on yet. Sometimes it works. @error normally 1 if it failed.

Here is my code for testing. I even put a loop for doing mapping for 5 seconds. Still failed.

; Map to network drive

$strUserID = "MTN\authscript"

$strPassword = "aut91hr3"

$sourceDir = "\\lestat1\apps\Licensed_APPS\SiSoftware_Sandra_2005_Pro"

UnmapNetworkDrives()

; Map to network drive

$begin = TimerInit()

While 1

$dif = TimerDiff($begin)

$result = DriveMapAdd("O:", $sourceDir, 1, $strUserID, $strPassword)

if ($dif > 5000) Or $result Then

ExitLoop

EndIf

WEnd

MsgBox(0, "Result " & $result, "Error " & @error)

Share this post


Link to post
Share on other sites

Does the mapping always work when you do it manually (without AutoIt)?

It is. I am managing to make it work by using a sleep in the loop. I had same experience using other scripting language. When I had my WinXP DriveMapAdd() function working, I was so exciting about AutoIt3. Just don't know Win2K is so different than WinXP in terms of DriveMapAdd() function.

Thanks a lot.

; Map to network drive

$strUserID = "MTN\authscript"

$strPassword = "aut91hr3"

$sourceDir = "\\lestat1\apps\Licensed_APPS\SiSoftware_Sandra_2005_Pro"

UnmapNetworkDrives()

; Map to network drive

$begin = TimerInit()

While 1

$dif = TimerDiff($begin)

$result = DriveMapAdd("O:", $sourceDir, 1, $strUserID, $strPassword)

if ($dif > 5000) Or $result Then

ExitLoop

else

Sleep(500)

EndIf

WEnd

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0