in reply to Feeding values to an existing program
Somewhat vague problem statement, but sounds like a job for Expect.