Welcome to the VanDyke Software Forums

Join the discussion today!

Go Back   VanDyke Software Forums > Scripting


Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
Old 03-26-2021, 02: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 03:00 PM. Reason: Please wrap code with a [CODE] tag at the beginning and a [/CODE] tag at the end.
Reply With Quote

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT -6. The time now is 05:23 AM.