Hi folks,
Due to being unable to find a suitable app, i've decided to make a little app (with the help from my trusty DWeb chums)
Currently i'm looking at a little app that will allow me to enter a username and password for... whatever purpose really, map drive, shared folder etc etc etc"
I have found and modified a "hta" script that has a username and passwrod text entry field.
What i would like to add now is... after enterting the username and password and clicking the "run script" button, the script will verify the username and password entered with the one stored inside the script its self.
Then i want to add a modified vbs script into the hta script that will run a cmd prompt and perform the comand i want it to... Does that make sense :-)
its very nearly complete, however im just on the final streach now but cant seem to see where i need to go next...
Heres what we have so far in hta.
<head>
<title>Run Script</title>
<HTA:APPLICATION
APPLICATIONNAME="Test"
BORDER="thin"
SCROLL="no"
SINGLEINSTANCE="yes"
WINDOWSTATE="normal"
>
</head>
<script language="VBScript">
Sub Window_onLoad
intWidth = 400
intHeight = 300
Me.ResizeTo intWidth, intHeight
Me.MoveTo ((Screen.Width / 2) - (intWidth / 2)),((Screen.Height / 2) - (intHeight / 2))
End Sub
Sub Default_Buttons
If Window.Event.KeyCode = 13 Then
btn_runscript.Click
End If
End Sub
Sub RunScript
If Trim(txt_username.Value) = "" Then
MsgBox "Please enter your username."
txt_username.Focus
ElseIf Trim(txt_password.Value) = "" Then
MsgBox "Please enter your password."
txt_password.Focus
Else
Set objShell = CreateObject("WScript.Shell")
objShell.Run strCommand, 0, True
On Error Resume Next
End If
End Sub
</script>
<body style="background-color:#B0C4DE; font-family: arial" onkeypress='vbs:Default_Buttons'>
<table width='90%' height = '100%' align='center' border='0'>
<tr>
<td align='center'>
<h2>Run Script</h2>
</td>
</tr>
<tr>
<td>
User Name:<br>
<input type="text" maxlength="30" size="40" id="txt_username" name="txt_username"><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 align='center'>
<input type="button" value="Run Script" name="btn_runscript" onClick="vbs:RunScript">     
<input type="button" value="Exit" name="btn_exit" onClick="vbs:window.close"><br><br>
</td>
</tr>
</table>
</body>
AND now THE VBS
Dim storedPassword
Password ="[I]testpassword1[/I]"
Dim storedusername
username ="[I]testusername1[/I]"
if entered password = Password Then
WScript.Echo "Correct"
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run "[I]enter whaever command you want it to run after correct entry of details, here[/I]"
Else
WScript.Echo "Incorrect"
End if
So basically i want to merge these 2 files into 1 hta (glorified vbs) then i can sleep :-)
Thanks in advance if anyone can help... i'll keep plodding along as well
Phreak.