Thanks a million! Expect is very interresting indeed; Didn't expect such a tool to exist in my wildest dreams. Now I can automize telnet sessions!
Concerning my particular issue, as far as I can tell expect only interacts with programs of that were launched by it.
What I want to do is have a script that sends commands to programs which are already running to be able to control them by voice.
typing a
makes xmms play
and
makes it stop the playback
but this only work with xmms. When applying the same logic for a video player, it opens another instance of it.
Any more clues?