Bob1988 Posted January 22, 2018 Share Posted January 22, 2018 (edited) hallo every one, i tried to write a small tool with it i can add or remove a netwrok drive. can somebody help me. expandcollapse popup#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 Edited January 22, 2018 by Bob1988 Link to comment Share on other sites More sharing options...
rudi Posted January 22, 2018 Share Posted January 22, 2018 Hi. So what is your issue? Regards, Rudi. Earth is flat, pigs can fly, and Nuclear Power is SAFE! Link to comment Share on other sites More sharing options...
Earthshine Posted January 22, 2018 Share Posted January 22, 2018 I’ll test it when I get back to pc My resources are limited. You must ask the right questions Link to comment Share on other sites More sharing options...
jguinch Posted January 22, 2018 Share Posted January 22, 2018 It works, but GUISetState() is missing to show the GUI on startup Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF Link to comment Share on other sites More sharing options...
Bob1988 Posted January 23, 2018 Author Share Posted January 23, 2018 how i can change it? Link to comment Share on other sites More sharing options...
Bob1988 Posted January 23, 2018 Author Share Posted January 23, 2018 14 hours ago, rudi said: Hi. So what is your issue? Regards, Rudi. i can't start it. Link to comment Share on other sites More sharing options...
jguinch Posted January 23, 2018 Share Posted January 23, 2018 Add GUISetState() before the While 1 loop Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now