I'm new to coding and I have a question,
I got an internal web application "Third Party" called Touch and Go it's a electronic management board.
I am wanting a vbs script to open, enter your user name and password and log in automatically when a PC user signs in.
I have it to the point to where it will launch the website, It will input the user name and password. however I cannot get it to submit.
*******This is the code to the software.*********
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "<HTML>
<HEAD>
<link REL="SHORTCUT ICON" HREF=" >
<TITLE>Touch N' Go Internet Edition Login</TITLE>
<script type="text/JavaScript">
<!--
function setfocus(){
document.logform.lname.focus();
if(document.location != "document.location = "}
}
function setcookie() {
document.cookie = "TNG=x" ; domain="192.*.*.*";
}
setcookie();
// End -->
</SCRIPT>
<SCRIPT type="text/JavaScript">
<!-- Begin
var thecookie;
var userlevel;
var usernumber;
var usersplit;
function readlevel() {
var level;
thecookie = document.cookie;
level = thecookie.split("+");
usersplit = level[0].split("=");
userlevel = level[1];
usernumber = usersplit[1];
usergroup = level[2];
}
// End -->
</SCRIPT>
<SCRIPT type="text/JavaScript">
<!-- Begin
function formHandler(form){
var URL = document.adminjavaform.admin.options[document.adminjavaform.admin.selectedIndex].value;
window.location.href = URL;
}
function reportHandler(form){
var URL = document.reportform.report.options[document.reportform.report.selectedIndex].value;
window.location.href = URL;
}
function srch(form){
var usr = document.search.searchtext.value;
window.location.href = " usr + ".htm";
}
function intng(){
status.value="0";
}
function outtng(){
status.value="0" ;
}
// End -->
</SCRIPT>
</HEAD><BODY leftmargin="0" topmargin="0" onload="setfocus();" bgcolor ="White">
<table width = "100%" bgcolor="#708090" cellpadding="0" cellspacing="0" border="0" ><tr><td height="20"><a href=" Alt="Touch N' Go" SRC="/graphics/TNGcorp.gif" border="0"></a></td></tr></table>
<table height="30" hspace="0" vspace="0" background=" border="0" cellpadding="0" cellspacing="0" width="100%" >
<tr><td class="head" valign="middle" align="left">
<INPUT type="Image" onClick="history.back()" Name="imgback" SRC=" border="0" ALT="Back|" Title="Back " ><INPUT type="Image" onClick="history.forward()" Name="imgFwd" SRC=" border="0" ALT="Forward|" Title="Forward " ></td><td class="head" valign="middle" align="left"><b>Touch N' Go Login</b></TD>
<td valign="middle" align ="right">
<font face="Arial, Helvetica, sans-serif" size="-2" color="black">
Thursday 25 August, 2011</font></td>
</tr></table>
<FORM action="" Method="POST" name="logform">
<table border="0" width="300">
<INPUT type="hidden" name="TNGpage" value="TNGLogin">
<INPUT type="hidden" name="ipaddress" value="192.*.*.*" >
<tr>
<td width="120"><font face="Arial,Helvetica,Sans Serif" size=2>Login Name: </td><td width="100"><font face="Arial,Helvetica,Sans Serif" size=2><INPUT type="Text" tabindex="1" id="lname" name="lname" size="20"</td>
</tr><tr>
<td width="120"><font face="Arial,Helvetica,Sans Serif" size=2>Password: </td><td width="100"><font face="Arial,Helvetica,Sans Serif" size=2><INPUT tabindex="2" type="password" id="pword" name="pword" size="20"</td>
</tr>
</table>
<INPUT type="Submit" VALUE="Submit Your Login" >
<INPUT type="Reset" VALUE="Clear This Form">
</form>
<table height="30" hspace="0" vspace="0" background=" border="0" cellpadding="0" cellspacing="0" width="100%">
<td>Leave both blank for guest access</td></tr></table>
<A HREF=" SRC=" border="0"></a>
</BODY>
</HTML>
********This is the code that I am using in my VBS Script.*******
WScript.Quit Main
Function Main
Set IE = WScript.CreateObject("InternetExplorer.Application", "IE_")
IE.Visible = True
IE.Navigate " Wait IE
With IE.Document
.getElementByID("lname").value = "My Username"
.getElementByID("pword").value = "My Password"
Not Sure What To Put Here To Submit The Form?
End With
End Function
Sub Wait(IE)
Do
WScript.Sleep 500
Loop While IE.ReadyState < 4 And IE.Busy
Do
WScript.Sleep 500
Loop While IE.ReadyState < 4 And IE.Busy
End Sub
Sub IE_OnQuit
On Error Resume Next
WScript.StdErr.WriteLine "IE closed before script finished."
WScript.Quit
End Sub
I have tried adding send {ENTER} key but it just opens a new webpage.
Any help would be very much Thankful.
HyDrOz.
I got an internal web application "Third Party" called Touch and Go it's a electronic management board.
I am wanting a vbs script to open, enter your user name and password and log in automatically when a PC user signs in.
I have it to the point to where it will launch the website, It will input the user name and password. however I cannot get it to submit.
*******This is the code to the software.*********
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "<HTML>
<HEAD>
<link REL="SHORTCUT ICON" HREF=" >
<TITLE>Touch N' Go Internet Edition Login</TITLE>
<script type="text/JavaScript">
<!--
function setfocus(){
document.logform.lname.focus();
if(document.location != "document.location = "}
}
function setcookie() {
document.cookie = "TNG=x" ; domain="192.*.*.*";
}
setcookie();
// End -->
</SCRIPT>
<SCRIPT type="text/JavaScript">
<!-- Begin
var thecookie;
var userlevel;
var usernumber;
var usersplit;
function readlevel() {
var level;
thecookie = document.cookie;
level = thecookie.split("+");
usersplit = level[0].split("=");
userlevel = level[1];
usernumber = usersplit[1];
usergroup = level[2];
}
// End -->
</SCRIPT>
<SCRIPT type="text/JavaScript">
<!-- Begin
function formHandler(form){
var URL = document.adminjavaform.admin.options[document.adminjavaform.admin.selectedIndex].value;
window.location.href = URL;
}
function reportHandler(form){
var URL = document.reportform.report.options[document.reportform.report.selectedIndex].value;
window.location.href = URL;
}
function srch(form){
var usr = document.search.searchtext.value;
window.location.href = " usr + ".htm";
}
function intng(){
status.value="0";
}
function outtng(){
status.value="0" ;
}
// End -->
</SCRIPT>
</HEAD><BODY leftmargin="0" topmargin="0" onload="setfocus();" bgcolor ="White">
<table width = "100%" bgcolor="#708090" cellpadding="0" cellspacing="0" border="0" ><tr><td height="20"><a href=" Alt="Touch N' Go" SRC="/graphics/TNGcorp.gif" border="0"></a></td></tr></table>
<table height="30" hspace="0" vspace="0" background=" border="0" cellpadding="0" cellspacing="0" width="100%" >
<tr><td class="head" valign="middle" align="left">
<INPUT type="Image" onClick="history.back()" Name="imgback" SRC=" border="0" ALT="Back|" Title="Back " ><INPUT type="Image" onClick="history.forward()" Name="imgFwd" SRC=" border="0" ALT="Forward|" Title="Forward " ></td><td class="head" valign="middle" align="left"><b>Touch N' Go Login</b></TD>
<td valign="middle" align ="right">
<font face="Arial, Helvetica, sans-serif" size="-2" color="black">
Thursday 25 August, 2011</font></td>
</tr></table>
<FORM action="" Method="POST" name="logform">
<table border="0" width="300">
<INPUT type="hidden" name="TNGpage" value="TNGLogin">
<INPUT type="hidden" name="ipaddress" value="192.*.*.*" >
<tr>
<td width="120"><font face="Arial,Helvetica,Sans Serif" size=2>Login Name: </td><td width="100"><font face="Arial,Helvetica,Sans Serif" size=2><INPUT type="Text" tabindex="1" id="lname" name="lname" size="20"</td>
</tr><tr>
<td width="120"><font face="Arial,Helvetica,Sans Serif" size=2>Password: </td><td width="100"><font face="Arial,Helvetica,Sans Serif" size=2><INPUT tabindex="2" type="password" id="pword" name="pword" size="20"</td>
</tr>
</table>
<INPUT type="Submit" VALUE="Submit Your Login" >
<INPUT type="Reset" VALUE="Clear This Form">
</form>
<table height="30" hspace="0" vspace="0" background=" border="0" cellpadding="0" cellspacing="0" width="100%">
<td>Leave both blank for guest access</td></tr></table>
<A HREF=" SRC=" border="0"></a>
</BODY>
</HTML>
********This is the code that I am using in my VBS Script.*******
WScript.Quit Main
Function Main
Set IE = WScript.CreateObject("InternetExplorer.Application", "IE_")
IE.Visible = True
IE.Navigate " Wait IE
With IE.Document
.getElementByID("lname").value = "My Username"
.getElementByID("pword").value = "My Password"
Not Sure What To Put Here To Submit The Form?
End With
End Function
Sub Wait(IE)
Do
WScript.Sleep 500
Loop While IE.ReadyState < 4 And IE.Busy
Do
WScript.Sleep 500
Loop While IE.ReadyState < 4 And IE.Busy
End Sub
Sub IE_OnQuit
On Error Resume Next
WScript.StdErr.WriteLine "IE closed before script finished."
WScript.Quit
End Sub
I have tried adding send {ENTER} key but it just opens a new webpage.
Any help would be very much Thankful.
HyDrOz.