Sign in to follow this  
Followers 0
gertsolo

Automating hyperterminal

4 posts in this topic

Hey,

I have a lot of IP devices that I have initialise the first time through a serial connection with Hyperterminal.

There is a sequence of configuration that has to be done. (first 3 times pressing the escape key, then entering boot at the prompt, then waiting for it to boot and show a login prompt, entering configuration data, etc...)

I have to wait each time for a certain text or question on the hyperterminal screen to enter some configuration stuff.

How can I do this?


The more you learn, the less you know.

Share this post


Link to post
Share on other sites



Hey,

I have a lot of IP devices that I have initialise the first time through a serial connection with Hyperterminal.

There is a sequence of configuration that has to be done. (first 3 times pressing the escape key, then entering boot at the prompt, then waiting for it to boot and show a login prompt, entering configuration data, etc...)

I have to wait each time for a certain text or question on the hyperterminal screen to enter some configuration stuff.

How can I do this?

I wouldn't use Hyperterminal, though maybe someone will tell you how you could do it.

I would use a serial COMs udf.

DaleHohm has this thread,

and I have a this one.

Naturally I am more familiar with mine but you could do what you want with either. Mine has a simple sort of terminal as a sample script, so it might help to get you going.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

Thx Martin,

I'm gonna try your UDF. Could you help me along a bit.

For example, if I want to monitor the port on the entering of "Console Login", which and how do I use your functions?

rgds


The more you learn, the less you know.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Thx Martin,

I'm gonna try your UDF. Could you help me along a bit.

For example, if I want to monitor the port on the entering of "Console Login", which and how do I use your functions?

rgds

NOt sure what you mean.

Do you mean you want to send 'Console Login' to a COM port, or do you mean you want to detect when 'Console Login' is received?

The basic approach using my udf is

First open the port

_CommSetPort(...set with the COM number, baud rate etc. Check for errors, see the udf for explanation and see my example.

to send a string

_CommSendString($SomeString);Remember that if you want @CR at the end then you must add that to the string otherwise you might not get an answer.

to read a Line

_CommGetLine(@CR,200,30000); wait until string received ending in @CR, or string length gets to 200 char or 30 seconds has elapsed.

OR

_CommGetLine((@CR,0,0); wait for string terminated by @CR, don't care how long the string is, don't care how long you have to wait.

OR

_CommGetString() returns whatever characters are available.

OR

_CommReadChar(0) read the next char but if there isn't one don't wait for one.

There are other functions as well.

Finally, always close the port

_ComClosePort()

If you only need one COM port then I recommend that you download from the Get Commg.zip link because it has been tested by more people than the more recent Get Commgv2.zip, although anything you do with Commg you should be able to do with Commgv2.

If you have any more questions then I am happy to answer them. I prefer that you post questions in the Commg thread though because then any problem which is solved can be shared by other people more easily. (And I'm more likely to notice it. :) )

to read s tring

Edited by martin

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

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