Jump to content

Scripting Within a Telnet Connection


kineda
 Share

Recommended Posts

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!

Link to comment
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().
Link to comment
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...

Link to comment
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.
Link to comment
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?

Link to comment
Share on other sites

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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...