#include #include #include #include #include #Region ### START Koda GUI section ### Form=C:\Users\mkluge\OneDrive\DriveMapping.kxf Global $DriveMapping = GUICreate("RKOS Drive Mapping", 525, 350, 1121, 113) GUISetIcon("C:\Users\mkluge\OneDrive\Pictures\Redknee_Small.ico", -1) GUISetBkColor(0xFFFFFF) Global $Welcome = GUICtrlCreateLabel("Welcome to RKOS Drive Mapping Utility", 10, 130, 300, 22) GUICtrlSetFont(-1, 12, 400, 0, "Arial") Global $Enter_Username = GUICtrlCreateLabel("Please Enter OS Username an Password", 10, 160, 202, 18) GUICtrlSetFont(-1, 8, 400, 0, "Arial") Global $RK_Claim = GUICtrlCreatePic("C:\Users\mkluge\OneDrive\Pictures\Redknee_Main_Red-500.gif", 10, 10, 500, 100) Global $Password = GUICtrlCreateLabel("Password:", 10, 225, 70, 20) GUICtrlSetFont(-1, 10, 400, 0, "Arial") Global $Username = GUICtrlCreateLabel("Username:", 10, 200, 70, 20) GUICtrlSetFont(-1, 10, 400, 0, "Arial") Global $Username_ID = GUICtrlCreateInput("", 90, 200, 145, 21) GUICtrlSetTip(-1, "Enter Username without OS\") Global $Password_ID = GUICtrlCreateInput("", 90, 225, 145, 21, $ES_PASSWORD) Global $Connect = GUICtrlCreateButton("Connect", 90, 272, 145, 25) GUICtrlSetTip(-1, "Click to Map Network Drives") GUICtrlCreateGroup("", 280, 190, 185, 135) Global $Radio_PAD = GUICtrlCreateRadio("Paderborn", 288, 198, 100, 17) Global $Radio_KOL = GUICtrlCreateRadio("Kolkata", 288, 255, 100, 17) Global $Radio_RIO = GUICtrlCreateRadio("Rio de Janeiro", 288, 275, 100, 17) Global $Radio_BUE = GUICtrlCreateRadio("Buenos Aires", 305, 292, 113, 17) Global $Radio_IST = GUICtrlCreateRadio("Istanbul", 305, 215, 60, 17) Global $Radio_ROM = GUICtrlCreateRadio("Rome", 375, 215, 60, 17) Global $Radio_KIV = GUICtrlCreateRadio("Kiev", 305, 232, 60, 17) ; Radio Button set to unchecked GUICtrlSetState($Radio_PAD, $GUI_UNCHECKED) GUICtrlCreateGroup("", -99, -99, 1, 1) Global $Select_Home = GUICtrlCreateLabel("Select your Home Location", 280, 160, 202, 18) GUICtrlSetFont(-1, 8, 400, 0, "Arial") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### ; Functions Fileshares Func _Global_Drives() DriveMapAdd("X:", "\\pad-server\Projectdoc", 1, "os\" & $Username, $Password) ; slow DriveMapAdd("U:", "\\pad-server\Projectdoc_Old", 1, "os\" & $Username, $Password) ; slow DriveMapAdd("Y:", "\\pad-server\Shared", 1, "os\" & $Username, $Password) ; slow EndFunc ;==>_Global_Drives Func _PAD_Drives() DriveMapAdd("I:", "\\pad-server\Install", 1, "os\" & $Username, $Password) ; slow DriveMapAdd("N:", "\\pad-server\Departments", 1, "os\" & $Username, $Password) ; slow DriveMapAdd("T:", "\\pad-server\Temp", 1, "os\" & $Username, $Password) ; slow DriveMapAdd("Z:", "\\pad-server\Systems", 1, "os\" & $Username, $Password) ; slow EndFunc ;==>_PAD_Drives Func _KOL_Drives() DriveMapAdd("I:", "\\kol-server\dml", 1, "os\" & $Username, $Password) ; slow DriveMapAdd("W:", "\\kol-server\Home\" & $Username, 1, "os\" & $Username, $Password) ; slow DriveMapAdd("T:", "\\kol-server\Temp", 1, "os\" & $Username, $Password) ; slow DriveMapAdd("Z:", "\\kol-server\Systems", 1, "os\" & $Username, $Password) ; slow EndFunc ;==>_KOL_Drives Func _RIO_Drives() DriveMapAdd("I:", "\\rio-server\Temp", 1, "os\" & $Username, $Password) ; slow DriveMapAdd("K:", "\\rio-server\Departments", 1, "os\" & $Username, $Password) ; slow DriveMapAdd("M:", "\\pad-server\Departments", 1, "os\" & $Username, $Password) ; slow DriveMapAdd("T:", "\\rio-server\Temp", 1, "os\" & $Username, $Password) ; slow DriveMapAdd("Z:", "\\rio-server\Systems", 1, "os\" & $Username, $Password) ; slow EndFunc ;==>_RIO_Drives Func _PAD_Home() DriveMapAdd("W:", "\pad-server\Home\" & GUICtrlRead($Username), 1, " os\" & $Username, $Password) ; slow EndFunc ;==>_PAD_Home While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Connect $Username = GUICtrlRead($Username_ID) $Password = GUICtrlRead($Password_ID) If $Username = '' Or $Password = '' Then MsgBox(16, 'Error', 'Empty username or password') ContinueLoop EndIf If GUICtrlRead($Radio_PAD) = 1 Then MsgBox(64, 'Notification', 'You select Paderborn as your location for your Homedrive', 3) _Global_Drives() _PAD_Drives() ;~ _PAD_Home ElseIf GUICtrlRead($Radio_KOL) = $GUI_CHECKED Then MsgBox(64, 'Notification', 'You select Kolkata as your location for your Homedrive', 3) _Global_Drives() _KOL_Drives() ElseIf GUICtrlRead($Radio_IST) = $GUI_CHECKED Then MsgBox(64, 'Notification', 'You select Istanbul as your location for your Homedrive', 3) _Global_Drives() _PAD_Drives() ElseIf GUICtrlRead($Radio_ROM) = $GUI_CHECKED Then MsgBox(64, 'Notification', 'You select Rome as your location for your Homedrive', 3) _Global_Drives() _PAD_Drives() ElseIf GUICtrlRead($Radio_KIV) = $GUI_CHECKED Then MsgBox(64, 'Notification', 'You select Kiev as your location for your Homedrive', 3) _Global_Drives() _PAD_Drives() ElseIf GUICtrlRead($Radio_RIO) = $GUI_CHECKED Then MsgBox(64, 'Notification', 'You select Rio de Janeiro as your location for your Homedrive', 3) _Global_Drives() _RIO_Drives() ElseIf GUICtrlRead($Radio_BUE) = $GUI_CHECKED Then MsgBox(64, 'Notification', 'You select Buenos Aires as your location for your Homedrive', 3) _Global_Drives() _RIO_Drives() ElseIf GUICtrlRead($Radio_BUE) = $GUI_CHECKED Then MsgBox(64, 'Notification', 'You select Buenos Aires as your location for your Homedrive', 3) _Global_Drives() _RIO_Drives() EndIf If @error Then Switch @error Case 1 $err_message = 'Undefined / Other error. Windows API return code: ' & @extended Case 2 $err_message = 'Access to the remote share was denied' Case 3 $err_message = 'At least one device is already assigned' Case 4 $err_message = 'Invalid device name' Case 5 $err_message = 'Invalid remote share' Case 6 $err_message = 'Invalid password' EndSwitch GUISetCursor(2) MsgBox(16, 'Error', $err_message, 6) Else ; everything OK Exit EndIf EndSwitch WEnd