Search the Community
Showing results for tags 'add network drive'.
-
hallo every one, i tried to write a small tool with it i can add or remove a netwrok drive. can somebody help me. #include <GUIConstants.au3> #include <ComboConstants.au3> ; For GUICtrlCreateCombo #include <File.au3> ; Opt("GUICoordMode", 1) $Window = GUICreate("add or remov network drive", 440,210, -1, -1) GUISetBkColor (0xFFFFFF) GUICtrlCreateLabel("choose letter:", 20, 13, 170, 25) $FreeNetworkdrive = GUICtrlCreateCombo("", 200, 10, 40, 25) GUICtrlCreateLabel("give the path:", 20, 43, 400, 25) $URLNetworkdrive = GuiCtrlCreateInput("", 20, 60, 310, 20) $Networkdrivechoose = GUICtrlCreateButton ("choose path", 340, 60, 80, 20) $Networkdriveconnect = GUICtrlCreateButton ("connect", 20, 100, 160, 25) $close = GUICtrlCreateButton ("close", 310, 100, 110, 25) $UsedNetworkdrive = GUICtrlCreateCombo("", 20, 160, 40, 25) $Networkdriveremove = GUICtrlCreateButton ("remoce", 70, 162, 200, 17) GUICtrlSetBkColor($Networkdriveremove,0xff0000) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit(0) Case $Networkdriveconnect If GUICtrlRead($FreeNetworkdrive) = "" Or GUICtrlRead($URLNetworkdrive) = "" Then MsgBox(16, "Error", "please add all infos!") Else DriveMapAdd(GUICtrlRead($FreeNetworkdrive),GUICtrlRead($URLNetworkdrive),9) If @error Then MsgBox(16, "Error", "Network not connected. Errorcode:" & " " & @error & @CRLF & @CRLF & "-----") Else MsgBox(64, "", "connected") ;GUISetState(@SW_HIDE) ;GUISetState(@SW_ENABLE) ;GUISetState(@SW_SHOW) EndIf EndIf Case $close GUISetState(@SW_HIDE) GUISetState(@SW_ENABLE) GUISetState(@SW_SHOW) Case $NetWorkdriveremove If GUICtrlRead($UsedNetWorkdrive) = "" Then MsgBox(16, "Error", "info not complet!") Else DriveMapDel(GUICtrlRead($UsedNetworkdrive)) If @error Then MsgBox(16, "Error", "Can not remove network ..." & " " & @error & @CRLF & @CRLF & "----") Else MsgBox(64, "", "Network removed") GUISetState(@SW_HIDE) GUISetState(@SW_ENABLE) GUISetState(@SW_SHOW) EndIf EndIf EndSwitch WEnd