'script to use InterNet Explorer as User Interface
Dim doc, page, strIETitle, oDB
' Instantiate database class
Set odb = New DataBaseFunctions
strIETitle="On Call Verification Thingie - Ver .60"
fn=WScript.scriptFullName
p=InStrRev(fn,"\")
appldir=Left(fn,p)
Set objShell = CreateObject("WScript.Shell")
Set objIE=WScript.CreateObject("internetexplorer.application","iexplore_")
With objIE
.ToolBar = False
.StatusBar = False
.Resizable = False
.Navigate("about:blank")
Do Until .readyState = 4
WScript.Sleep 100
Loop
With .document
With .ParentWindow
intWidth = .Screen.AvailWidth
intHeight = .Screen.AvailHeight
intWidthW = .Screen.AvailWidth * .50
intHeightW = .Screen.AvailHeight * .38
' Was .05
.resizeto intWidthW, intHeightW
.moveto (intWidth - intWidthW)/2, (intHeight - intHeightW)/2
End With
.Write "<body> " & strMsg & " </body></html>"
With .ParentWindow.document.body
.style.backgroundcolor = "LightBlue"
.scroll="no"
.style.Font = "10pt 'Courier New'"
.style.borderStyle = "outset"
.style.borderWidth = "4px"
End With
.Title = strIETitle
objIE.Visible = True
WScript.Sleep 100
objShell.AppActivate strIETitle
End With
End With
objIE.visible=True
' Test sleep below
WScript.Sleep 6000
html="oncall.htm"
loadDocument(html)
ieLoaded
bReady=False
Do
WScript.sleep(100)
If html<>"" Then
loadDocument(html)
ieLoaded
End If
Loop until bReady
Set objIE=Nothing
WScript.Quit
Sub iexplore_onQuit()
bReady=True
End Sub
Sub loadDocument(adoc)
objIE.navigate(appldir & adoc)
page=adoc
html=""
'wait till document loaded
Do While objIE.readystate<>4
Loop
'doc is defined here
Set doc=objIE.document
End Sub
Sub iesubmit()
Select Case page
Case "oncall.htm"
ie_form
Case Else
End Select
page=doc.forms(0).action
html=page
End Sub
Sub ieLoaded()
Select Case page
Case "oncall.htm"
ie_form_loaded
Case Else
End Select
End Sub
Sub ie_form()
strName=doc.forms(0).elements("strName").value
MsgBox(strName)
End Sub
Sub ie_form_loaded()
objIE.document.forms(0).elements("submit").onclick=GetRef("iesubmit")
End Sub
Class DataBaseFunctions
' This class is to be used client side.
' Declare variables to have public scope.
Public rs
Public cn
'Method to initialize connection to database
Private Sub Init
If IsObject(cn) = False Then
Set cn = CreateObject("ADODB.Connection")
Set rs = CreateObject("ADODB.Recordset")
cn.ConnectionString = Application("DB_CONN")
cn.Open
End If
End Sub
' Method to destory objects created.
Public Sub Destroy
If IsObject(rs) = True Then
rs.Close
Set rs = Nothing
End If
If IsObject(cn) = True Then
cn.Close
Set cn = Nothing
End If
End Sub
End Class