PDA

View Full Version : vbscript to javascript form



hamboy
11-29-2007, 03:13 PM
Hi, I have a html form that's suppose to get username,password, date from textboxes, then use this info to login and get informaiton from another website. Last step is to display the retrieved data into the result textbox .

However, when I clock submit button, nothing happens. This is what I have:

<HTML>
<HEAD>
<TITLE>
Bug Count
</TITLE>
<SCRIPT LANGUAGE="javascript">
Option Explicit

Sub cmdCheck_ONCLICK
Dim objIE : Set objIE = CreateObject("InternetExplorer.Application")
Dim bugCount

objIE.Visible = True
objIE.Navigate "file://c:/result.html"
Do Until objIE.ReadyState = 4
WScript.Sleep 500
Loop

'Authentication
objIE.Document.getElementById("USER").value = username 'get from form input
objIE.Document.getElementById("PASSWORD").value = password 'get from form input
objIE.Document.Login.submit
WScript.Sleep 25000

'Created Date >=
objIE.Document.getElementById("FieldOp9").SelectedIndex = 4
objIE.Document.getElementById("FieldValue9").Value = dateinput 'get from form input

'Options
objIE.Document.getElementById("FieldOp17").SelectedIndex = 0
objIE.Document.getElementById("FieldValue17").SelectedIndex = 5
objIE.Document.getElementById("FieldOp13").SelectedIndex = 0
objIE.Document.getElementById("FieldValue13").SelectedIndex = 8

objIE.Document.ubiTrackForm.submit
WScript.Sleep 20000

bugCount = objIE.Document.getElementsByTagName("font").item(16).innerText
bugCount = Right(bugCount,2)

MsgBox "Bug Count: " & bugCount,0,"Data Extraction" '<--- output this to "result" textbox
objIE.Quit

end sub
</SCRIPT>
</HEAD>

<BODY BGCOLOR="white">
<FONT FACE="arial" SIZE=2><B>
<CENTER>
<H3>Bug Count</H3>
<FORM NAME="frmForm1">
<INPUT TYPE="text" NAME="username" SIZE=10>
<INPUT TYPE="text" NAME="password" SIZE=10>
<INPUT TYPE="text" NAME="dateinput" SIZE=10>
<P>
<INPUT TYPE="button" NAME="cmdCheck" VALUE="CHECK">

<INPUT TYPE="text" NAME="result" SIZE=10>
</FORM>
</BODY>
</HTML>