Page 1 of 1 1
Topic Options
#157421 - 2006-02-17 06:50 PM Telnet and Serial Connections
Gargoyle Offline
MM club member
*****

Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
I am looking for a way to setup a serial connection to devices using Telnet. Trying to do this without having to use thirdparty sofware (IE built in telnet from MS).

Is this possible? I have not found anything as of yet...
_________________________
Today is the tomorrow you worried about yesterday.

Top
#157422 - 2006-02-17 08:31 PM Re: Telnet and Serial Connections
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
What do you mean by setup? I use KiX to automate HyperTerminal to telnet to my switches albeit not serially. The help file explains how to pass parms on the commandline.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#157423 - 2006-02-17 09:38 PM Re: Telnet and Serial Connections
Gargoyle Offline
MM club member
*****

Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
Hyperterm may be my only choice. I was hoping to user the CommandLine Telnet, but do not see anyway to force a connection to a serial port.
_________________________
Today is the tomorrow you worried about yesterday.

Top
#157424 - 2006-02-18 03:48 PM Re: Telnet and Serial Connections
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
First off, I thought telnet was strictly TCP and that anything serial would have to be PPP.
What were you going to script with CL telnet if you could get it to work serially? If it involves any sort of SendKeys or AutoIT, it is doomed to fail.
BTDTGTTS

As I mentioned, I use HyperTerminal with KiX and AutoIT to automate pulling data from network switches, albeit with TCPIP telnet, nothing serial.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#157425 - 2006-02-18 04:48 PM Re: Telnet and Serial Connections
Gargoyle Offline
MM club member
*****

Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
We are in the process of rolling several hundred telecommuters, and I am writing a scritp that will allow anyone on my team config the routers for the telecommuters to take home.

This requires a serial connection, as IP is not up and running on them. It looks like I will have to go with Hyperterm and AutoIT, just means that it will take me longer to do as I have not worked with AutoIT as of yet (have it installed just never did anything with it.)

As for sendkey - I know that it can be really tricky, I have another script that logs into all of my routers and switches and backs them up everyday.
_________________________
Today is the tomorrow you worried about yesterday.

Top
#157426 - 2006-02-18 04:58 PM Re: Telnet and Serial Connections
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Here is some code that does IP.
Code:
break on

$=SetOption('Explicit','On')
$=SetOption('WrapAtEOL','On')

Dim $oAutoIT,$IP,$Date

$Date = Split(@Date,"/")
$Date = $Date[1]+'-'+$Date[2]+'-'+Right($Date[0],2)

; Create AutoIT object
$oAutoIT = CreateObject('AutoItX3.Control')
If @ERROR OR VarType($oAutoIt)<>9 'ERROR: Could not create AutoIt instance' ?
Exit @ERROR
EndIf

For $IP = 20 to 25
Run '"C:\Program Files\Windows NT\hypertrm.exe" /t 10.10.10.'+$IP
; Wait for Hyperterm window to appear...
If Not CInt($oAutoIT.WinWait('10.10.10.'+$IP,'',5))
'ERROR: Window took too long.' ?
Else
sleep 0.5
If Not CInt($oAutoIT.WinWait('10.10.10.'+$IP,'Connected',5))
$oAutoIt.Send('{ENTER}')
Endif
sleep 0.5
If Not CInt($oAutoIT.WinWait('10.10.10.'+$IP,'Connected',5))
$oAutoIt.Send('{ENTER}')
sleep 0.5
Endif
If Not CInt($oAutoIT.WinWait('10.10.10.'+$IP,'Connected',5))
'ERROR: Hyperterm to 10.10.10.'+$IP+' took too long.' ?
Else
sleep 0.5
$oAutoIt.Send('ThisIsNotThePassword{ENTER}')
sleep 1
$oAutoIt.Send('copy com "show tech mesh" tftp 10.10.10.10 '+$IP+'showmesh'+$Date+'.txt{ENTER}')
sleep 1
$oAutoIt.Send('logout{ENTER}')
sleep 0.2
$oAutoIt.Send('y')
sleep 0.5
$oAutoIt.Send('!{F4}')
sleep 0.5
$oAutoIt.Send('!n')
EndIf
EndIf
Next


_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#157427 - 2006-02-18 05:02 PM Re: Telnet and Serial Connections
Gargoyle Offline
MM club member
*****

Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
Thanks, at least I have something to work with now.
_________________________
Today is the tomorrow you worried about yesterday.

Top
#157428 - 2006-03-01 05:21 PM Re: Telnet and Serial Connections
Gargoyle Offline
MM club member
*****

Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
Ok, I have been working with AutoIt - and yes this may be the wrong place for this, but everyone here is so helpfull - I have been unable to discern how to read the text in the hyperterminal display window.

Here is my current bit of code..
Code:

Function WriteConfig()
$Auto = CreateObject('AutoItX3.Control')
If @ERROR OR VarType($Auto)<>9 'ERROR: Could not create AutoIt instance' ?
Exit @ERROR
EndIf
Run '"C:\Program Files\Windows NT\hypertrm.exe" serial'
Sleep 5
$Var = ""

While $Var <> "Router>"
? $Var
$Var = $Auto.ControlGetText("serial - HyperTerminal","","3")
Loop



$nul = $Auto.Send("{enter}")
$nul = $Auto.Send("EN{enter}")


Yes there is much more after that but not relevant to the problem.

When I ? $Var there is no output to the screen as if it is not reading the text.

I have tried several different way's of getting the text on the screen, but have not found it as of yet. And was hoping there was someone here that already had the answer.

I have also tried using TeraTerm, and SecureCRT, and none of them are working the way that I need.
_________________________
Today is the tomorrow you worried about yesterday.

Top
#157429 - 2006-03-01 05:31 PM Re: Telnet and Serial Connections
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
When you run the AutoIT Reveal Mode utility, it will show you what is available. Unfortunately, the contents of the HT main window is not picked up.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#157430 - 2006-03-01 05:36 PM Re: Telnet and Serial Connections
Gargoyle Offline
MM club member
*****

Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
I did run the reveal utility, and was able to find out that the main window has the ControlID of "3", or ClasNN of "TermClass1", and that is why I went with the "ControlGetText" function.

Or are you telling me that I will never be able to get the information that I am looking for, as this is critical to making the script work correctly.
_________________________
Today is the tomorrow you worried about yesterday.

Top
#157431 - 2006-03-01 05:44 PM Re: Telnet and Serial Connections
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
I'm sorry... I thought you were looking for something in the main window. I did not scrutinize your code. You may notice that in the code I posted, using WinWait, I look for the word 'Connected' which appears in the status bar. I have not played with ControlGetText.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#157432 - 2006-03-01 05:57 PM Re: Telnet and Serial Connections
Gargoyle Offline
MM club member
*****

Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
You are correct, I am trying to get the string from the main window.

What I am attempting to do is automate a router config script that will allow any one to setup up a Cisco router. They have the exact same config with very few changes to make each one work (perfect excuse to write a script), however I have to watch for specific types of prompts so I know what has to be done next without having to ask the user to do it.
_________________________
Today is the tomorrow you worried about yesterday.

Top
#157433 - 2006-03-01 06:55 PM Re: Telnet and Serial Connections
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
If you cannot simply rely on delays between sends, I think you will need to go a different route. There are probably lots of scriptable terminal emulators out there but the only commercial one I have ever scripted was Procomm Plus.
http://www.symantec.com/procomm/
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#157434 - 2006-03-02 07:00 PM Re: Telnet and Serial Connections
Gargoyle Offline
MM club member
*****

Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
Well I did find a tool that will allow me to script the serial ports.

From what I can tell it does not support COM automation, but it does have it's own built in script engine and interpreter.

So now I have to rewrite all of my code in the new script....

For those that are interested...
http://www.easyvitools.com/
_________________________
Today is the tomorrow you worried about yesterday.

Top
Page 1 of 1 1


Moderator:  Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 2220 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.069 seconds in which 0.03 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org