Update Excel from crt secure by scripting
hi all, im new to crt, recently i have created a sub to save screen and update it to excel,however base on vandyke sample i just can overwrite the excel file, is there any ideas that i can update the excel file whenever i run the script? here is my script:
# $language = "VBScript"
# $interface = "1.0"
' This script demonstrates how ActiveX scripting can be used to
' interact with CRT and manipulate other programs such as Microsoft Excel
' through an OLE automation interface. This script creates an instance of Excel,
' then it sends a command to a remote server (assuming we're already
' connected). It reads the output, parses it and writes out some of the
' data to an Excel spreadsheet and saves it. This script also demonstrates
' how the WaitForStrings function can be used to wait for more than one
' output string.
crt.screen.synchronous = true
' Create an Excel workbook/worksheet
Dim app, wb, ws
Set app = CreateObject("Excel.Application")
Set wb = app.Workbooks.Add
Set ws = wb.Worksheets(1)
crt.Screen.Send "en" & chr(13)
crt.Screen.Send "conf t" & chr(13)
crt.Screen.Send "do sh env all" & chr(13)
envStartString = "Switch(config)#do sh env all"
envEndingString = "Switch(config)#"
Set objTab1 = crt.GetScriptTab
if objTab1.Screen.WaitForString(envStartString, 30) = False then
MsgBox "We never found the """ & envStartString & """ string indicating " & _
"that we should begin the ReadString call. We will now exit the script"
envResult = objTab1.Screen.ReadString(envEndingString, 60)
ws.Cells(2, 1).Value = envresult
'ws.Cells(row, 2).Value = items(2)
Set ws = nothing
Set wb = nothing
Set app = nothing
crt.screen.synchronous = false
I am not sure where you found the example you posted, but I am confident one of these example scripts can help you to accomplish your objective.
|Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)|
|Display Modes||Rate This Thread|