Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > Scripting

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
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 ?

Code:
#$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"
 loop
  objFileToRead.Close
  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
  #2  
Old 03-26-2021, 02:03 PM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,596
Hi chill,

See this post. I think your source text file is suffering the same issue.
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #3  
Old 03-30-2021, 01:23 PM
chill chill is offline
Registered User
 
Join Date: Mar 2021
Posts: 2
Odd Characters in Output

Saving the text file in ANSI works.


Thanks Brenda !
Reply With Quote
  #4  
Old 03-30-2021, 01:50 PM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,596
Hi chill,

Great! I am glad to hear you were able to resolve the issue.
__________________
Thanks,
--Brenda

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


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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 02:54 AM.