For command line apps expect is quite helpful, for GUI applications X11::GUITest (linux) or Win32::GuiTest.
In reply to Re: Delphi automation by moritz in thread Delphi automation by krishi