Scripting with applications

Hi,
I am developing a script that invokes a program, and that program is going to prompt for some input every now and then based on some parameters.

My script shall provide input to the program, automatically, by processing the text output by the program..

say..
when the program asks

"username:" the script shall enter "griffin"
"room number:" the script shall enter 23
"what is the temperature at XX:XX hrs": the script shall refer to a file where a list of temperatures with corresponding times are present to give the appropriate answer.

For this, my script must be able to process the text output/prompted by the program.

How do I do this? Any help is much appreciated.

Thanks.

what will be the format of temperature file.

Can't the script take the "other file" as input? I guess am missing something :wink:

Format may be considered as below...

00:00-34
00:01-23
...
...
...

...
...
23:59-65

But this is not the real problem I have... I have cited this only as an example.. My script must be able to give inputs to the program **dynamically**.

**Dynamically** is the only question I have, for if the inputs to be provided and their ordering is same irrespective of the number of invocations, and they are known at the time of writing the script, I can write this way..

sh <script_name>.sh << EOF
<input#1>
<input#2>
<input#3>
EOF