Hi All,

I have written a little function to help me map drives and just wondering if there was a way to speed up the error message when the unc path that I am trying to map to does not exist???

 Code:
Function MapDrive($x_letter, $x_share, $x_user, $x_pass, $x_label )
  dim $ip_arr
  dim $regval

  If $x_letter And $x_share
    use $x_letter /DELETE

    If $x_user
      If $x_pass
        use $x_letter $x_share /user:$x_user /password:$x_pass
      Else
        use $x_letter $x_share /user:$x_user
      Endif
    Else
      use $x_letter $x_share
    Endif

    If @error <> 0
      $x= Messagebox ("Unable to map drive - " + $x_letter + " to " + $x_share + @crlf + @crlf + "Processing will continue.","Error",48,500)
      return
    EndIf

    If $x_label
      $ip_arr = Split ($x_share, "\")
      $regval = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\MountPoints2\##" + $ip_arr[2] + "#" + $ip_arr[3]
      WriteValue($regval,"_LabelFromReg",$x_label,"REG_SZ")
    Endif
  Endif

EndFunction

Any help will be appreciated.
_________________________
Regards,
Andy.


--Just shoot me, please.--