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 08-28-2005, 09:11 PM
wasodg2 wasodg2 is offline
Registered User
 
Join Date: Dec 2004
Location: Spokane, WAshington
Posts: 16
Angry Dropping Characters

Hello,

I have some code to send commands to switches with Secure CRT but no matter what I try it keeps dropping the first character of the command I send to the switch.

Here is part of the script.

objSe.Connect "/TELNET "&IPNumber&" 23"

If ( objSe.connected ) Then
i = i + 1
objse.logfilename = "c:\Switch\"&IPNumber&".Log"
objse.Log(True),True
objSc.WaitForString ":",1
SelectRow = objSc.CurrentRow
Login = objSc.Get(SelectRow, 1, SelectRow, 20)
objSc.WaitForString "assword:",1
objSc.Send "password" & vbCr
objSc.WaitForString">",1
objSc.Send "sho ver" & vbCr
objSc.WaitForString">",3
objSc.Synchronous = True
objSc.Send "SHOW Interface" & vbCr


It works until it gets to the "sho ver" or the "SHOW Interface" then it loses the first letter of the command and sends "HOW Interfac which of course doesn't work.

I use the Synchronous true statement and I have set it in numerous places with the same result.

What can I do to make it see the whole command ever time?

Please help!

Dave

Last edited by wasodg2; 08-28-2005 at 09:16 PM.
Reply With Quote
  #2  
Old 08-29-2005, 11:28 AM
bocks's Avatar
bocks bocks is offline
VanDyke Customer Support
 
Join Date: Jan 2004
Location: Albuquerque, NM
Posts: 184
Hello Dave,
Quote:
Originally Posted by wasodg2
I have some code to send commands to switches with Secure CRT but no matter what I try it keeps dropping the first character of the command I send to the switch.

Here is part of the script.

Code:
objSe.Connect "/TELNET "&IPNumber&" 23"

       If ( objSe.connected ) Then
            i = i + 1
            objse.logfilename = "c:\Switch\"&IPNumber&".Log"
            objse.Log(True),True
            objSc.WaitForString ":",1
            SelectRow = objSc.CurrentRow 
            Login = objSc.Get(SelectRow, 1, SelectRow, 20)
            objSc.WaitForString "assword:",1
            	 objSc.Send "password" & vbCr
            	 objSc.WaitForString">",1
              objSc.Send "sho ver" & vbCr
             objSc.WaitForString">",3
             objSc.Synchronous = True
             objSc.Send "SHOW Interface" & vbCr
It works until it gets to the "sho ver" or the "SHOW Interface" then it loses the first letter of the command and sends "HOW Interfac which of course doesn't work.

I use the Synchronous true statement and I have set it in numerous places with the same result.

What can I do to make it see the whole command ever time?

Please help!

Dave
Normally, the synchronous = true statement should be made as soon as the connection is made, and left set to true in order to avoid missing information that the server may send.

In looking at this code, I noticed that you are calling two separate objects:
Code:
objse
and
Code:
objSc
Can you tell me how these objects are defined?

It is also possible that SecureCRT is sending the data to fast for the device to pick up the first character. Have you tried to place a sleep statement between the WaitForString statement and the Send statement?

It would also be helpful if we were able to see a log of what is supposed to happen normally. Would you be able to send us a log of a session?

In order to better understand your script, would you be able to send us the complete script?

If so, please send them to me at
Quote:
Support@vandyke.com
with a subject of: Attn: Shannon re: Forum thread 981

Thanks,

-bocks
Reply With Quote
  #3  
Old 09-07-2005, 09:26 AM
Chaucer Chaucer is offline
Registered User
 
Join Date: Jun 2005
Posts: 52
Generally I put "objSc.Synchronous = True" at the start of my scripts. You also might want to try something like the following:

objSc.WaitForString">",3
objSc.WaitForCursor 2
objSc.Send "SHOW Interface" & vbCr
Reply With Quote
  #4  
Old 09-08-2005, 09:00 AM
wasodg2 wasodg2 is offline
Registered User
 
Join Date: Dec 2004
Location: Spokane, WAshington
Posts: 16
Smile

I tried a few thing suggested by Bocks and the only thing that works is a leading space in front on the command like this " SHOW interface".

The switch ignores the first character if it is a space anyway so it works.

THanks for you help!

Dave
Reply With Quote
  #5  
Old 09-10-2005, 01:37 PM
GTECH317 GTECH317 is offline
Registered User
 
Join Date: Sep 2005
Posts: 3
I had the same problem, sometimes even characters in the middle of a string sent to a router/switch were lost. Using crt.Sleep fixes the problem, but can slow down the script.
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 04:45 AM.