View Single Post
Old 03-26-2021, 01:55 PM
chill chill is offline
Registered User
Join Date: Mar 2021
Posts: 2
Odd Characters in Output

I'm trying to set up a script to query stations in a DMS10 telco switch. The below script will read the commands from a text file and loop through each line to the end. However the first time the crt.Screen.Send command runs it outputs this: que stn 222 2222 to the switch which causes a syntax error. It should be just this: que stn 222 2222. Each time after that its clean. It seems like its something coming with the variable str or from the text file.

If I put the que stn in the command and take it out of the text file crt.Screen.Send "que stn" & str & chr(13). I get this: que stn222 2222

Any thoughts of how to get rid of these characters ?

#$language = "VBScript"
#$interface = "1.0"
crt.Screen.Synchronous = True
Sub Main
 Set objFileToRead = CreateObject("Scripting.FileSystemObject").OpenTextFile("C:\Users\Secure CRT Scripts\dn.txt",1)
 do while not objFileToRead.AtEndOfStream
Dim str
 crt.Screen.Send "####" & chr(13)
crt.Screen.WaitForString "REQ"
 str = objFileToRead.ReadLine()
crt.Screen.Send chr(8)
 ' Msgbox "Click to go on", , "Example"
 crt.Screen.Send str & chr(13)
crt.Screen.WaitForString "REQ"
  Set objFileToRead = Nothing
End Sub

Last edited by jdev; 03-30-2021 at 02:00 PM. Reason: Please wrap code with a [CODE] tag at the beginning and a [/CODE] tag at the end.
Reply With Quote