|
'-------- IEDisplay Class ----------------------------------
Class IEDisplay
Private m_WindowTitle, m_InitialText, m_NumberOfLabels, m_AlignTables
Private FSO, IE, sTemp
Private Sub Class_Initialize()
'On Error Resume Next
Set FSO = CreateObject("Scripting.FileSystemObject")
sTemp = FSO.GetSpecialFolder(2)
'Set IE = CreateObject("InternetExplorer.Application")
Set IE = WScript.CreateObject("InternetExplorer.Application", "IE_")
With IE
.AddressBar = False
.menubar = False
.ToolBar = False
.StatusBar = False
.width = 300
.height = 150
.resizable = True
.visible = True
End With
m_WindowTitle = ""
m_InitialText = ""
m_NumberOfLabels = 1
m_AlignTables = "horizontal"
End Sub
Private Sub Class_Terminate()
On Error Resume Next
IE.Quit
Set IE = Nothing
Set FSO = Nothing
End Sub
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Public Sub Show()
dim TempPath
TempPath = FSO.GetSpecialFolder(2)
dim DQ
DQ = chr(34)
Dim TS
Set TS = FSO.CreateTextFile(TempPath + "\IEDisplay.html", True)
TS.WriteLine "<HTML><HEAD><TITLE>" + m_WindowTitle + "</TITLE></HEAD>"
TS.WriteLine "<BODY BGCOLOR=" + DQ + "CCCCCC" + DQ + ">"
TS.writeLine "<table border=" + DQ + "1" + DQ + " cellpadding=" + DQ + "2" + DQ + _
" cellspacing=" + DQ + "0" + DQ + " style=" + DQ + "border-collapse: collapse" + DQ + _
" bordercolor=" + DQ + "#111111" + DQ + " width=" + DQ + "100%" + DQ + " id=" + DQ + _
"AutoNumber1" + DQ + ">"
TS.WriteLine "<tr>"
Dim Percent
Percent = cint(100 / m_NumberOfLabels)
for i = 1 to m_NumberOfLabels
TS.WriteLine "<td width=" + DQ + cstr(Percent) + "%" + DQ + "valign=" + DQ + "top" + DQ + ">"
TS.WriteLine "<FONT FACE=" + DQ + "New Times Roman" + DQ + " SIZE=2><LABEL ID=" _
+ DQ + "Label" + cstr(i) + DQ + ">" + m_InitialText + "</LABEL></FONT>"
TS.WriteLine "</td>"
If m_AlignTables = "vertical" Then
TS.WriteLine "</tr></table>"
If i < m_NumberOfLabels Then
TS.writeLine "<table border=" + DQ + "1" + DQ + " cellpadding=" + DQ + "5" + DQ + _
" cellspacing=" + DQ + "0" + DQ + " style=" + DQ + "border-collapse: collapse" + DQ + _
" bordercolor=" + DQ + "#111111" + DQ + " width=" + DQ + "100%" + DQ + " id=" + DQ + _
"AutoNumber1" + DQ + ">"
TS.WriteLine "<tr>"
End If
End If
Next
If m_AlignTables = "horizontal" Then
TS.WriteLine "</tr></table>"
End If
TS.WriteLine "</HTML>"
TS.Close
Set TS = Nothing
IE.Navigate "file:///" + TempPath + "\IEDisplay.html"
Dim Wsh
Set Wsh = CreateObject("Wscript.Shell")
Wsh.AppActivate "Internet Explorer"
Set Wsh = Nothing
wscript.sleep 100
End Sub
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Public Sub Resize(Width,Height)
With IE
.width = Width
.height = Height
End With
End Sub
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Public Sub Move(PixLeft, PixTop)
IE.Left = PixLeft
IE.Top = PixTop
End Sub
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Public Sub SetText(TextForWindow,LabelNumber)
On Error Resume Next
If IE.Visible = False Then
'wscript.echo "The IE Window has been Closed, this script: " + WScript.ScriptFullName + " cannot continue and will now exit."
wscript.quit
End If
Select case LabelNumber
case 1
IE.Document.parentWindow.Label1.innerText = TextForWindow
case 2
IE.Document.parentWindow.Label2.innerText = TextForWindow
case 3
IE.Document.parentWindow.Label3.innerText = TextForWindow
case 4
IE.Document.parentWindow.Label4.innerText = TextForWindow
case 5
IE.Document.parentWindow.Label5.innerText = TextForWindow
End Select
End Sub
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Public Sub AppendText(TextForWindow,LabelNumber)
On Error Resume Next
If IE.Visible = False Then
'wscript.echo "The IE Window has been Closed, this script: " + WScript.ScriptFullName + " cannot continue and will now exit."
wscript.quit
End If
Select case LabelNumber
case 1
IE.Document.parentWindow.Label1.innerText = IE.Document.parentWindow.Label1.innerText + TextForWindow
case 2
IE.Document.parentWindow.Label2.innerText = IE.Document.parentWindow.Label2.innerText + TextForWindow
case 3
IE.Document.parentWindow.Label3.innerText = IE.Document.parentWindow.Label3.innerText + TextForWindow
case 4
IE.Document.parentWindow.Label4.innerText = IE.Document.parentWindow.Label4.innerText + TextForWindow
case 5
IE.Document.parentWindow.Label5.innerText = IE.Document.parentWindow.Label5.innerText + TextForWindow
End Select
End Sub
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'Set Window Title
Public Property Let WindowTitle(sTitle)
m_WindowTitle = sTitle
End Property
'Set default Window Text
Public Property Let InitialText(sText)
m_InitialText = sText
End Property
'Set Number of Labels, max of 5
Public Property Let NumberOfLabels(sLabels)
If sLabels <=5 then
m_NumberOfLabels = sLabels
else
m_NumberOfLabels = 5
End If
End Property
'Get the number of labels being used
Public Property Get NumberOfLabels
NumberOfLabels = m_NumberOfLabels
End Property
'Set labels to be Horizontal or Vertical
Public Property Let Horizontal_Vertical_Labels(sLabels)
m_AlignTables = sLabels
End Property
End class
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.