Wilson WindowWare Tech Support

WinBatch WinBatch+Compiler WebBatch
Home | Tech Database | Tech BBS | White Papers | Purchase


Update File Manager Network Drive Buttons
in Windows NT

Keywords: winfile network drive buttons	  

Question:

Why in the Windows NT File Manager are the drive buttons not updated if I change mappings to network drives or logout from network servers?

Answer:

I found the answer and for those who are interested, here it is:

I just logged off from the Novell domain, re-logged-in and mapped the drives. But I have to properly cleanup my connections first and then re-login.

Cleanup means: first delete all mappings, second detach from all servers in the domain.

Every part of the system, including WinFile, now knows about the changes.

The script I use now:

;==================
; Preliminaries
;==================

BatchTitle = "Login to Novell"
WinTitle("", BatchTitle)

AddExtender("c:\tools\winbatch\system\wwn4x34I.dll")

ErrorMode(@off)

Beep
ThePassword = AskPassword("Login MyUserName", "Password?")

WinTitle("", "%BatchTitle%: Map delete")

;==================
; Delete mappings
;==================

MappedDrives = n4GetMapped("")
ICount	     = ItemCount(MappedDrives, @TAB)
FOR i = 1 TO ICount
  TheDrive = ItemExtract(i, MappedDrives, @TAB)
  Success  = n4MapDelete(TheDrive)
NEXT i

;=====================
; Logoff from domain
;=====================

WinTitle("", "%BatchTitle%: Logout")
Success = n4Logout()

;==================
; Detach
;==================

WinTitle("", "%BatchTitle%: Detach")

Success = n4Detach("\\OurServers_DATA1")
Success = n4Detach("\\OurServers_PROG1")
Success = n4Detach("\\OurServers_PROG2")

;==================
; Re-login
;==================

WinTitle("", "%BatchTitle%: Login")

Success = n4Login( "MyUserName", ThePassword, "Our.Context", "OurTree")
Errormsg = "Login error!"
IF !Success THEN GOTO ErrorHandler

;==================
; Re-Attach
;==================

WinTitle("", "%BatchTitle%: Attach")

Success = n4Attach("\\OurServers_DATA1")
ErrorMsg = "Error! Login to OurTree tree OK, but attach to \\OurServers_DATA1 failed!"
IF !Success THEN GOTO ErrorHandler

Success = n4Attach("\\OurServers_PROG2")
ErrorMsg = "Error! Login to OurTree OK, but attach to \\OurServers_PROG2 failed!"
IF !Success THEN GOTO ErrorHandler

;==================
; Re-map
;==================

WinTitle("", "%BatchTitle%: Mapping")

ErrorMsg = "Error! Mapping of F: to \\OurServers_PROG1\USERS\MyUserDir failed!"
IF !n4Map("\\OurServers_PROG1\USERS\MyUseDir" , "F:") THEN GOTO ErrorHandler

ErrorMsg = "Error! Mapping of P: to \\OurServers_PROG2\DATA\USERS\MyUserDir failed!"
IF !n4Map("\\OurServers_PROG2\DATA\USERS\MyUserDir" , "P:") THEN GOTO ErrorHandler

ErrorMsg = "Error! Mapping of O: to \\OurServers_DATA1\DEPARTMENT failed!"
IF !n4Map("\\OurServers_DATA1\DEPARTMENT", "O:") THEN GOTO ErrorHandler

ErrorMsg = "Error! Mapping of S: to \\OurServers_PROG2\TheVolume failed!"
IF !n4Map("\\OurServers_PROG2\TheVolume", "S:") THEN GOTO ErrorHandler

;==================
; Yeah!
;==================

WinTitle("", "%BatchTitle%: OK!")
Beep
TimeDelay(3)

;==================
; EndOfBatch
;==================

:EndOfBatch
EXIT

;============================
; Sub-routeine: Errorhandler
;============================

:ErrorHandler
Message(BatchTitle, ErrorMsg)
EXIT

Article ID:   W13642
Filename:   Update File Manager Network Drive Buttons.txt