Login | |
|
 |
help with script - html output - 5/30/2006 7:30:04 AM
|
|
 |
|
| |
tjritch
Posts: 2
Score: 0
Joined: 11/4/2005
Status: offline
|
new to scripting...keep getting errors running this script: '=================================================================== Dim oShell: Set oShell = CreateObject("Wscript.Shell") forceUseCScript Dim oIE: Set oIE = CreateObject("InternetExplorer.Application") Dim ScriptPath: ScriptPath = Left(Wscript.ScriptFullName,Len(WScript.ScriptFullName) - Len(WScript.ScriptName)) Dim strComputers, reply, parse Dim strComputer: strComputer = Split(replace(InputBox("ENTER PC NAMES COMMA DELIMITED","Enter the PC's to monitor IP connectivity","www.microsoft.com,localhost,www.google.com,127.0.0.1,anybogusname")," ",""),",") ReDim strComputers(UBound(strComputer),1) For i = 0 To UBound(strComputer) strComputers(i,0) = strComputer(i) strComputers(i,1) = "UNK" Next setupDisplay num = 0 Do While IsObject(oIE) strHtml = " chr(34) & "position: absolute; left: 1; top: 1" & Chr(34) & ">" For i = 0 To UBound(strComputers,1) oIE.Document.Title = "Now Checking " & strComputers(i,0) & "..." strComputers(i,1) = pingHost(strComputers(i,0), parse) strHtml = strHtml & "|" Select Case strComputers(i,1) Case "UNK" strHtml = strHtml & "Chr(34) & parse & Chr(34) & ">" & strComputers(i,0) & "" Case "UP" strHtml = strHtml & "Chr(34) & parse & Chr(34) & ">" & strComputers(i,0) & "" Case "DOWN" strHtml = strHtml & "Chr(34) & parse & Chr(34) & ">" & strComputers(i,0) & "" Case Else strHtml = strHtml & "Chr(34) & parse & Chr(34) & ">" & strComputers(i,0) & "" End Select Next strHtml = strHtml & "| " oIE.Document.body.innerhtml = strHTML For i = 1 To 5 oIE.Document.Title = "Waiting 5 seconds... " & i WScript.Sleep 1000 next Loop function pingHost(host, parse) strCmd = "%COMSPEC% /C ping " & host & " -n 1" Set reply = oShell.Exec(strCmd) While Not reply.StdOut.atendofstream parse = reply.StdOut.readline If InStr(parse,"Reply") Then pingHost = "UP" reply.StdOut.readAll Exit function Elseif InStr(parse,"timed out") Then pingHost = "DOWN" reply.StdOut.readAll Exit function ElseIf InStr(parse,"Unknown") Then pingHost = "UNK" reply.StdOut.readAll Exit function Else pingHost = "UNK" End If Wend End function Sub setupDisplay() oIE.AddressBar = False oIE.Height = 55 oIE.Width = 75 oIE.MenuBar = False oIE.Resizable = True oIE.StatusBar = False oIE.ToolBar = False oIE.Navigate "about:blank" oIE.FullScreen = true maxWidth = oIE.width maxHeight = oIE.Height oIE.FullScreen = False oIE.Top = maxHeight - 75 oIE.width = maxWidth oIE.Visible = True oShell.AppActivate "about:blank" oIE.Document.Title = "Loading..." oIE.Document.body.innerhtml = "chr(34) & "position: absolute; left: 1; top: 1" & Chr(34) & ">Loading..." WScript.Sleep 2000 End Sub Sub forceUseCScript() If Not WScript.FullName = WScript.Path & "\cscript.exe" Then oShell.Run WScript.Path & "\cscript.exe //NOLOGO " & Chr(34) & WScript.scriptFullName & Chr(34),1,False WScript.Sleep 2000 WScript.Quit 0 End If End Sub
|
|
| |
|
|
|
|
|