View Single Post
  #9  
Old 01-07-2019, 10:22 AM
ekoranyi ekoranyi is offline
VanDyke Technical Support
 
Join Date: Jan 2017
Posts: 654
Hi amy_itx_aps,

I apologize, I missed a small but important feature. Rather than sending the command using crt.Screen.Send, we need to be sure to specify which tab the command gets sent to. This can be done by modifying the ConnectInTab line and the Send/WaitForString lines.

Code:
#$language = "VBScript"
#$interface = "1.0" 

'turn on synchronous mode so we don't miss any data
crt.Screen.Synchronous = True

Sub Main

    Set fso = CreateObject("Scripting.FileSystemObject")
    Set file = fso.OpenTextFile("C:\Users\user\Desktop\test.txt")

    Do Until file.AtEndOfStream 
    line = file.ReadLine
    commendAndLog line
    Loop

End Sub

Sub commendAndLog(line)

    equipmentInfo = Split(line)

    ip = equipmentInfo(0)
    uname = equipmentInfo(1)
    pwd = equipmentInfo(2)
    path = equipmentInfo(3)

    Set objTab = crt.session.ConnectInTab("/SSH2 /L " & uname & " /PASSWORD " & pwd & " " & ip)

    objTab.Screen.WaitForString("$")
    objTab.Screen.Send " cd " & path & chr(13)
    objTab.Screen.WaitForString("$")

End Sub
Does making these changes give you the desired behavior?
__________________
Thanks,
--Eric

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730

Last edited by ekoranyi; 01-09-2019 at 09:37 AM.
Reply With Quote