I'm fairly new to javascript and HTAs but here's what I have so far:
<HTML>
<HEAD>
<title>Create Drive</title>
<HTA:APPLICATION
APPLICATIONNAME="CreateDrive"
VERSION="1.0"
SINGLEINSTANCE="yes"/>
<SCRIPT language="JavaScript">
window.resizeTo(400,300)
function WriteFile() {
var fso = new ActiveXObject("Scripting.FileSystemObject");
var fh = fso.CreateTextFile("output.txt", true);
fh.WriteLine(userinfo.UN.value + ' ' + userinfo.FN.value + ' ' + userinfo.LN.value);
fh.Close();
}
</SCRIPT>
</HEAD>
<BODY>
<FORM name="userinfo">
<P>User Name: <INPUT name="UN" type="text"></P>
<P>First Name: <INPUT name="FN" type="text"></P>
<P>Last Name: <INPUT name="LN" type="text"></P>
<P><INPUT type="button" value="Create Drive" onclick="WriteFile();"></P>
</FORM>
</BODY>
</HTML>
My goal is to use this HTA to create network drives for new user accounts. Previously, to accomplish this, a .bat was used that referenced a VBScript and the user entered three values (user, first, and last name) which were passed along to the .vbs and created the drive:
cscript /nologo newdrive.vbs q:\users\%1 /DFS:yes /server:server1 /server2:server2 /userfirstname:%2 /userlastname:%3 /quiet:no
I would like to access this VBScript directly from my HTA and pass the values of UN, FN, and LN. I'm currently saving the values entered into a text file, but I appreciate any info on completing this a better way.
Thanks for your assistance.