473,395 Members | 1,583 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Modify a script

53
I would like to modify this script so that it maps to the share, strDrive, instead of the users home directory. Thanks for any help

Expand|Select|Wrap|Line Numbers
  1. </head>
  2. <title>Map Network Drive</title>
  3. <HTA:APPLICATION 
  4.      APPLICATIONNAME="Map Drive"
  5.      BORDER="thin"
  6.      SCROLL="no"
  7.      SINGLEINSTANCE="yes"
  8.      WINDOWSTATE="normal"
  9. >
  10. </head>
  11.  
  12. <script language="VBScript">
  13. Dim strDrive
  14.  
  15. Sub Window_onLoad
  16.     strDrive = "\\10.92.36.249\data\"
  17.     If Right(strDrive, 1) <> "\" Then strDrive = strDrive & "\"
  18.     intWidth = 800
  19.     intHeight = 600
  20.     Me.ResizeTo intWidth, intHeight
  21.     Me.MoveTo ((Screen.Width / 2) - (intWidth / 2)),((Screen.Height / 2) - (intHeight / 2))
  22.     txt_drivepath.Value = strDrive
  23. End Sub
  24.  
  25. Sub Default_Buttons
  26.     If Window.Event.KeyCode = 13 Then
  27.         btn_mapdrive.Click
  28.     End If
  29. End Sub
  30.  
  31. Sub Update_Path
  32.     txt_drivepath.Value = strDrive & txt_username.Value
  33. End Sub
  34.  
  35. Sub MapDrive
  36.     If Trim(txt_username.Value) = "" Then
  37.         MsgBox "Please enter a username."
  38.         txt_username.Focus
  39.     ElseIf Trim(txt_password.Value) = "" Then
  40.         MsgBox "Please enter a password."
  41.         txt_password.Focus
  42.     Else
  43.         Set objNetwork = CreateObject("WScript.Network") 
  44.         uName = txt_username.Value
  45.         pWord = txt_password.Value
  46.         homeDrive = txt_drivepath.value
  47.         On Error Resume Next
  48.         objNetwork.MapNetworkDrive "J:", homeDrive, True, uName, pWord
  49.         If Err.Number = 0 Then
  50.             Err.Clear
  51.             On Error GoTo 0
  52.             MsgBox "Drive mapping complete."
  53.         Else
  54.             Err.Clear
  55.             On Error GoTo 0
  56.             MsgBox "Failed to map network drive."
  57.         End If
  58.     End If
  59. End Sub
  60.  
  61. </script>
  62.  
  63. <body STYLE="font:14 pt arial; color:white;filter:progid:DXImageTransform.Microsoft.Gradient
  64. (GradientType=1, StartColorStr='#000033', EndColorStr='#0000FF')" onkeypress='vbs:Default_Buttons'>
  65.     <table width='90%' height = '100%' align='center' border='0'>
  66.         <tr>
  67.             <td align='center'>
  68.                 <h2>Map a Drive</h2>
  69.             </td>
  70.         </tr>
  71.         <tr>
  72.             <td>
  73.                 User Name:<br>
  74.                 <input type="text" maxlength="30" size="40" id="txt_username" name="txt_username" onchange="vbs:Update_Path"><br><br>
  75.             </td>
  76.         </tr>
  77.         <tr>
  78.             <td>
  79.                 Pasword:<br>
  80.                 <input type="password" maxlength="30" size="40" id="txt_password" name="txt_password"><br><br>
  81.             </td>
  82.         </tr>
  83.         <tr>
  84.             <td>
  85.                 Drive Path:<br>
  86.                 <input type="text" maxlength="30" size="40" id="txt_drivepath" name="txt_drivepath" readonly><br><br>
  87.             </td>
  88.         </tr>
  89.         <tr>
  90.             <td align='center'>
  91.                 <input type="button" value="Map Drive" name="btn_mapdrive"  onClick="vbs:MapDrive"><br><br>
  92.             </td>
  93.         </tr>
  94.     </table>
  95.  
  96. </body>
May 3 '10 #1
0 821

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: Don | last post by:
I want the server-side php script to return a browser page that is essentially a copy of the original client page that contained the <form> which referenced the php script in the first place....
4
by: natty | last post by:
I have been trying to edit a script for a drop down type menu. the script is working as the sub menus flash up when i hover over the title links, but they are appearing in the top left hand corner...
1
by: scorpion53061 | last post by:
I really like this javascript for an image slideshow. The only thing I woudl like to do differently is have a cell above the image and navigation that would allow text content to be placed. Does...
11
by: tlyczko | last post by:
Hello Rob B posted this wonderful code in another thread, http://groups.google.com/group/comp.lang.javascript/browse_thread/thread/c84d8538025980dd/6ead9d5e61be85f0#6ead9d5e61be85f0 I could not...
2
by: Benjamin Rutt | last post by:
I often execute a long-running python script which is a "driver" for my application; it may run for several hours on a large input. Under CPython, is it safe for me to modify the Python script...
7
by: kelly | last post by:
Hi I have an app where I have 2 dropdown lists (state and city) and a Save button. When a user selects a value from the state dropdown list, I use script callback to populate the data for the...
5
by: DavidB | last post by:
Greetings I don't know if this is possible, but this group should be able to tell me. I have a webpage with a changing message board (I understand the problems with having changing text, but...
3
by: jaeden99 | last post by:
I was wandering if nyone has a script to move files older than x days old? i've seen several to delete, but I don't want to delete. I would like to create a backup of the files first verify with...
5
by: kidders | last post by:
Below is a script i need to modify to work and its driving me nuts. Essentially it fades the content of an array. The original script specified the object name, I tried to modify it to allow an...
4
by: Zarich | last post by:
This is a part of a code that i use to upload a video and a picture,but i want to modify the img part to upload the file in a diferent folder and i don't want it to create an unique folder for each...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.