Jump to content

DriveMapAdd() failed for Win2K ONLY ?


Recommended Posts

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

Link to comment
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)

Link to comment
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

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...