Access to Prompt

Hello,

I have a question concerning the following script which I can execute in a terminal:

telnet horizons.jpl.nasa.gov 6775

I will be asked to enter a certain number in order to select an object
(just for completness 301=moon, the tool yields the ephemeris for solar system objects)

Horizons> 301

now I have to press Enter for continuing...

Next step is for example ([E]phemeris:

Horizons>E

and so on....

My question:

Is it possible to enter the full information (e.g 301 && E.....) at once?
If yes, can I read in a (shell) script in order to run the object selection?

I am not an expert....

Thanks!
Gordon

Automating telnet can be annoying. It doesn't have well-defined control mechanisms for text buffering and process control and multiple streams the way ssh has, which makes automating it a long sequence of print ; sleep ; print ; sleep ; print ; sleep etc.

Expect might help you. autoexpect in particular, which can generate a script from commands you execute, which you can modify to your needs after.

Hello Corona688,

thanks for answer!
I will give it a try.

Cheers,
Gordon

Hi,

autoexpect works fine! I can perform all the things I want, execept the following:

I execute the following command:

./new2Script.exp 301 E o coord g \" 44.33 33.33 0.034\" y \" \ BC78-Jun-30 00:00\" \"BC78-Jun-30 23:59\" 6h n \" 2 4 31\" Refracted \
| grep b0 > object1.csv

That means, all lines including "b0" will be passed to the script object1.csv.
The problem, when I run telnet in the terminal I get the following output:

.....
.....
b0100-Jun-22 05:41, 1685070.736805556,*, ,287.52610,-27.62500, 254.8621,-29.9992, 285.5319607, -4.8664092,
 < Scroll & Page: space, <cr>, <b>ack, OR arrow keys. <q> ends display. > 1

that means the script does not show the full output.
The user has to scroll down in order to see further output. Unfortunately, my command cannot handle it.
Is it possible to show the full output?

Cheers,
Gordon

Without seeing your expect script it's hard to correct it, but one could probably get it to respond to the line "< Scroll & Page: space, <cr>, <b>ack, OR arrow keys. <q> ends display. >" by printing a space.

Hi,

the code is in attachment.

Cheers,
Gordon