Sign in to follow this  
Followers 0
kineda

Scripting Within a Telnet Connection

7 posts in this topic

Hey guys,

i am trying to write a script to run some automated processes through a telnet program for some terminal servers. so far i've been able to have the script open the app, select the proper type of connection but after the connection initiates is where i am lost. when i opened the "AutoIT Window Info" and point it at the telnet app it acts like it doesnt see any of the terminal emulation what so ever. is this something that cannot be done with autoit or is it just a case of i need a different telnet program that i can change the emulation type that will be something autoit can recognize?

thanks guys!

Share this post


Link to post
Share on other sites



Hey guys,

i am trying to write a script to run some automated processes through a telnet program for some terminal servers. so far i've been able to have the script open the app, select the proper type of connection but after the connection initiates is where i am lost. when i opened the "AutoIT Window Info" and point it at the telnet app it acts like it doesnt see any of the terminal emulation what so ever. is this something that cannot be done with autoit or is it just a case of i need a different telnet program that i can change the emulation type that will be something autoit can recognize?

thanks guys!

this is a problem that alot of us have run into. the way that i work with the emulater at my office is by using specific coordinate copy's (you can highlight with the mouse, then right click and copy from anywhere on the screen) and then using clipget to get the data. to check if the screen is ready for new input, i use the cursor position from the status bar with StatusBarGetText().

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

this is a problem that alot of us have run into. the way that i work with the emulater at my office is by using specific coordinate copy's (you can highlight with the mouse, then right click and copy from anywhere on the screen) and then using clipget to get the data. to check if the screen is ready for new input, i use the cursor position from the status bar with StatusBarGetText().

see i was thinking about that but i was planning on putting in my script to look for errors as well but since i cant get autoit to read any of the emulation im stuck...

Share this post


Link to post
Share on other sites

see i was thinking about that but i was planning on putting in my script to look for errors as well but since i cant get autoit to read any of the emulation im stuck...

well you can still do lots of error checks etc... if you're using mouse clicks to grab info off the screen, you can check the data for length, invalid characters etc. using normal validation, IsNumber(), IsString() StringLen() are all helpful for that. also the status bar can be VERY helpful. in the system we telnet into, there is a command prompt where you can enter account numbers, or a different account number where you can enter commands. i can determine which is on screen by seeing if the cursor is at position "14, 1" or "12, 2", and i can make it wait at any stage of the process for one of those to become true. typically i'll have an infinite loop with a Select - Case structure to handle the possible responses, and a case else that returns an error that an unexpected cursor position is received for an extended period of time. the stuff that i automate is usually either updating an account, or checking status/payments from a list of accounts. the latter can sometimes be problematic because of various error messages that return status codes that i haven't written cases for, so i use a little UDF i made to send the error messages to my phone (because i don't want to sit at my desk and wait for them) if you check topics i've started by clicking on my name, that UDF is the one titled "small semi-useless thing" or something like that, i've only started a few... let me know if you want to see any of my actual code for sending, checking status, copying etc and i'll append a code bit.

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

well you can still do lots of error checks etc... if you're using mouse clicks to grab info off the screen, you can check the data for length, invalid characters etc. using normal validation, IsNumber(), IsString() StringLen() are all helpful for that. also the status bar can be VERY helpful. in the system we telnet into, there is a command prompt where you can enter account numbers, or a different account number where you can enter commands. i can determine which is on screen by seeing if the cursor is at position "14, 1" or "12, 2", and i can make it wait at any stage of the process for one of those to become true. typically i'll have an infinite loop with a Select - Case structure to handle the possible responses, and a case else that returns an error that an unexpected cursor position is received for an extended period of time. the stuff that i automate is usually either updating an account, or checking status/payments from a list of accounts. the latter can sometimes be problematic because of various error messages that return status codes that i haven't written cases for, so i use a little UDF i made to send the error messages to my phone (because i don't want to sit at my desk and wait for them) if you check topics i've started by clicking on my name, that UDF is the one titled "small semi-useless thing" or something like that, i've only started a few... let me know if you want to see any of my actual code for sending, checking status, copying etc and i'll append a code bit.

let me clarify what i am trying to do... i am using tera term pro right now but what the plan was for this script was to connect via serial cable, log into the terminal server, check the firmware version, and flash it if necessary. problem is connecting via rs232 and having autoit read the emulation. i searched a little on the site and see that im not the only one with the problem. ive seen people recommend console telnet, putty, plink etc but im not seeing a serial interface within them... is this going to be one of those things where im going to have to parse the log file per connection? or might there be a way to read emulation via autoit?

Share this post


Link to post
Share on other sites

Grrr. I was going to say TCP functions can be used, but if you're using RS232, I can't think of any other way to do it...does hyperterm have a command-line interface?


Writing AutoIt scripts since
_DateAdd("d", -2, _NowCalcDate())

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

i am trying to write a script to run some automated processes through a telnet program for some terminal servers.

Check this out. Expect and AutoExpect from NIST.GOV and Windows version from ActiveState. It may be what you need if it's still around: AutoExpect download and general info page.

Expect "talks" to other interactive programs according to the commands defined in the Tcl script from which Expect is called. It can handle output from the program and provide the correct response based on possibilities outlined in the script. Tcl provides branching and high-level control structures to direct the exchange.

For example, Expect can:

Control console-based remote applications via Telnet, SSH or rlogin.

Configure routers and other devices accessed through console-based interfaces.

Carry session settings such as environment variables or current directory across rlogin, Telnet, tip, su, chgrp, etc.

Edited by jefhal

...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0