Expand|Select|Wrap|Line Numbers
- </head>
- <title>Map Network Drive</title>
- <HTA:APPLICATION
- APPLICATIONNAME="Map Drive"
- BORDER="thin"
- SCROLL="no"
- SINGLEINSTANCE="yes"
- WINDOWSTATE="normal"
- >
- </head>
- <script language="VBScript">
- Dim strDrive
- Sub Window_onLoad
- strDrive = "\\10.92.36.249\data\"
- If Right(strDrive, 1) <> "\" Then strDrive = strDrive & "\"
- intWidth = 800
- intHeight = 600
- Me.ResizeTo intWidth, intHeight
- Me.MoveTo ((Screen.Width / 2) - (intWidth / 2)),((Screen.Height / 2) - (intHeight / 2))
- txt_drivepath.Value = strDrive
- End Sub
- Sub Default_Buttons
- If Window.Event.KeyCode = 13 Then
- btn_mapdrive.Click
- End If
- End Sub
- Sub Update_Path
- txt_drivepath.Value = strDrive & txt_username.Value
- End Sub
- Sub MapDrive
- If Trim(txt_username.Value) = "" Then
- MsgBox "Please enter a username."
- txt_username.Focus
- ElseIf Trim(txt_password.Value) = "" Then
- MsgBox "Please enter a password."
- txt_password.Focus
- Else
- Set objNetwork = CreateObject("WScript.Network")
- uName = txt_username.Value
- pWord = txt_password.Value
- homeDrive = txt_drivepath.value
- On Error Resume Next
- objNetwork.MapNetworkDrive "J:", homeDrive, True, uName, pWord
- If Err.Number = 0 Then
- Err.Clear
- On Error GoTo 0
- MsgBox "Drive mapping complete."
- Else
- Err.Clear
- On Error GoTo 0
- MsgBox "Failed to map network drive."
- End If
- End If
- End Sub
- </script>
- <body STYLE="font:14 pt arial; color:white;filter:progid:DXImageTransform.Microsoft.Gradient
- (GradientType=1, StartColorStr='#000033', EndColorStr='#0000FF')" onkeypress='vbs:Default_Buttons'>
- <table width='90%' height = '100%' align='center' border='0'>
- <tr>
- <td align='center'>
- <h2>Map a Drive</h2>
- </td>
- </tr>
- <tr>
- <td>
- User Name:<br>
- <input type="text" maxlength="30" size="40" id="txt_username" name="txt_username" onchange="vbs:Update_Path"><br><br>
- </td>
- </tr>
- <tr>
- <td>
- Pasword:<br>
- <input type="password" maxlength="30" size="40" id="txt_password" name="txt_password"><br><br>
- </td>
- </tr>
- <tr>
- <td>
- Drive Path:<br>
- <input type="text" maxlength="30" size="40" id="txt_drivepath" name="txt_drivepath" readonly><br><br>
- </td>
- </tr>
- <tr>
- <td align='center'>
- <input type="button" value="Map Drive" name="btn_mapdrive" onClick="vbs:MapDrive"><br><br>
- </td>
- </tr>
- </table>
- </body>