Here is an example of the Live Writer PlugIn from Steve Dunn. As you can see I have added height and width restrictions to the DIV style alongwith a "autoflow:auto ". This causes the scrollbars to be turned on whenever the textflow exceeds the DIV size. Adding these choices to the control by retrieveing the heghth and width of the formatter control and allowing a checkbox to turn on scrollbars would make this Writer AddIn awesome.
1 Option Explicit 2 Const ForReading = 1 3 Const ForAppending = 8 4 Const sLogFileName = "d:\log.txt" 5 Const sServerFileName = "d:\servers.txt" 6 'On Error Resume Next 7 Dim objDictionary, objFSO, objOU, objComputer, strComputer 8 Dim colNetcards, objWMIService, objNetcard, arrWINSServers 9 Dim i, objItem, sName, objTextFile, strNextLine 10 11 Set objDictionary = CreateObject("Scripting.Dictionary") 12 Set objFSO = CreateObject("Scripting.FileSystemObject") 13 Set objTextFile = objFSO.OpenTextFile(sServerFileName, ForReading) 14 i = 0 15 Do Until objTextFile.AtEndOfStream 16 strNextLine = objTextFile.Readline 17 objDictionary.Add i, strNextLine 18 i = i + 1 19 Loop 20 objTextFile.close 21 22 Dim oLogFile 23 Set oLogFile = objFSO.OpenTextFile(sLogFileName, ForAppending) 24 For Each objItem in objDictionary 25 26 StrComputer = objDictionary.Item(objItem) 27 WScript.Echo "Begin pinging:" & strComputer 28 If TestPing(strComputer) = False Then 29 WScript.Echo now() & " Couldn't reach " & strComputer 30 oLogFile.WriteLine now() & " Couldn't reach " & strComputer 31 Else 32 WScript.Echo "Ping successful!" 33 Set objWMIService = GetObject("winmgmts:\\" & strComputer& "\root\cimv2") 34 Set colNetCards = objWMIService.ExecQuery("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled = TRUE AND NOT Description LIKE '%ISCSI'") 35 For Each objNetCard In colNetcards 36 WScript.Echo objNetCard.Description 37 arrWINSServers = Array("Null", "Null") 38 'objNetCard.SetWINSServerSearchOrder(arrWINSServers) 39 Next 40 End If 41 42 Next 43 44 oLogFile.Writeline "" 45 oLogFile.Close 46 WScript.echo "Script Finished" 47 48 Function TestPing(sName) 49 TestPing = false 50 If sName = "" Then 51 WScript.Echo "Bad computer name string!" 52 else 53 Dim cPingResults, oPingResult 54 Set cPingResults = GetObject("winmgmts://./root/cimv2").ExecQuery("SELECT * FROM Win32_PingStatus WHERE Address = '" & sName & "'") 55 For Each oPingResult In cPingResults 56 If oPingResult.StatusCode = 0 Then 57 TestPing = True 58 End If 59 Next 60 End if 61 End Function 62 63
No comments:
Post a Comment