#1
|
|||
|
|||
Logging on each tab
I'm trying to create a VBS script to perform the following,
1) connect to multiple hosts within tabs 2) log (raw) each tab with the "TabName__%Y%M%D%h%m%s.txt" 3) go to each tab and send a certain text string. I'm able to create the connections and name the tab as the host, at this point a box to name the log file opens for each connection. Once each connection has a file name then the text is sent. What is the trick to automatically name the files? Here is the script, # $language = "VBScript" # $interface = "1.0" '=============================================== 'LANG :VBScript 'VERSION : 1 '=============================================== Dim FSO, Shell, Windir, Runservice, File, File1 Dim g_objTab, g_strSkippedTabs, objProdTab, objTestTab, objDevTabm, objCurrentTab, nIndex Const ForReading = 1 Const ForWriting = 2 Const ForAppending = 8 Set FSO = CreateObject("scripting.filesystemobject") Set Shell = CreateObject("WScript.Shell") Set DeviceIP = FSO.opentextfile("c:\ftp\Rush\PORTS.txt", ForReading, False) Set Device1IP = FSO.opentextfile("c:\ftp\Rush\PORTS1.txt", ForReading, False) Set objDictionary = CreateObject("Scripting.Dictionary") Set objSc = crt.Screen Set objD = crt.Dialog Set objSe = crt.Session Set objW = crt.Window Logfiles = ("c:\ftp\Rush") While Not DeviceIP.atEndOfStream PORTS = DeviceIP.Readline() ' connect To host On port 23 (the Default telnet port) On Error Resume Next Set objProdTab = crt.Session.ConnectInTab("/telnet 10.255.0.94 "&PORTS&"") objProdTab.Screen.Synchronous = True objProdTab.Screen.WaitForString "]$", 1 objProdTab.Caption = ""&PORTS&"" wend Sub Main() Set g_objTab = crt.GetScriptTab g_objTab.Screen.Synchronous = True Dim nTest For nTest = 1 to crt.GetTabCount Set objCurrentTab = crt.GetTab(nTest) objCurrentTab.Activate if objCurrentTab.Session.Connected = True Then objCurrentTab.Session.Log True,False,True objCurrentTab.Session.LogFileName = "c:\1ftp\rush\"&PORTS&"_%Y%M%D%h%m%s%t.txt" end if next Dim nIndex2 For nIndex2 = 1 to crt.GetTabCount Set objCurrentTab = crt.GetTab(nIndex2) objCurrentTab.Activate objCurrentTab.Screen.Send chr(13) objCurrentTab.Screen.WaitForString "#",5 objCurrentTab.Screen.Send "thequickbrownfoxjumpsoverthelazydog123456789!@#$%^&*()_+" & vbcr objCurrentTab.Screen.WaitForString "#",5 next end sub Thanks, Don |
Thread Tools | |
Display Modes | Rate This Thread |
|
|