View previous topic :: View next topic |
Author |
Message |
naddahere n00b
Joined: 13 Aug 2005 Posts: 25
|
Posted: Sun Jul 22, 2007 6:20 am Post subject: How to send input to a running process through terminal? |
|
|
I want to send input through a script, program, or terminal to a running process or an X window after its been started. Specifically this process is epsxe, a ps1 emulator. I was thinking I might be able to do this with echo, but I have no idea how to do this.
Thanks in advance |
|
Back to top |
|
|
vad3r Guru
Joined: 02 May 2004 Posts: 461 Location: Munich, Germany
|
Posted: Tue Jul 24, 2007 9:36 am Post subject: |
|
|
I don't have any experience with epsxe. Does this process read input from STDIN? If it does you could try the following:
Code: | # mkfifo /path/epsxe.pipe
# epsxe < /path/epsxe.pipe &
# echo "This a a task" > /path/epsxe.pipe |
This may work. |
|
Back to top |
|
|
naddahere n00b
Joined: 13 Aug 2005 Posts: 25
|
Posted: Tue Jul 24, 2007 7:06 pm Post subject: |
|
|
No, it doesn't seem to support stdin. Is there a way to redirect program input from keyboard to console? or send console output to keyboard?
Thanks so much! |
|
Back to top |
|
|
vad3r Guru
Joined: 02 May 2004 Posts: 461 Location: Munich, Germany
|
Posted: Wed Jul 25, 2007 9:09 am Post subject: |
|
|
Console output to keyboard would be rather strange. You should forget that.
If you use the example i provided to you the input get's redirected from keyboard to STDIN. Have you tried to run the app as suggested? |
|
Back to top |
|
|
naddahere n00b
Joined: 13 Aug 2005 Posts: 25
|
Posted: Wed Jul 25, 2007 9:46 am Post subject: |
|
|
Yea, but epsxe still responds to keyboard and ignores STDIN. |
|
Back to top |
|
|
vad3r Guru
Joined: 02 May 2004 Posts: 461 Location: Munich, Germany
|
Posted: Wed Jul 25, 2007 9:52 am Post subject: |
|
|
I tested the example i wrote earlier with a simple perl script. It works very well. If you started expse as expected there should be no way for the process to get your keyboard typings. Only if you use the pipe. Can you please post your terminal output? |
|
Back to top |
|
|
Genone Retired Dev
Joined: 14 Mar 2003 Posts: 9546 Location: beyond the rim
|
Posted: Thu Jul 26, 2007 4:13 am Post subject: |
|
|
vad3r wrote: | I tested the example i wrote earlier with a simple perl script. It works very well. If you started expse as expected there should be no way for the process to get your keyboard typings. Only if you use the pipe. |
There are many ways to get keyboard input without using stdin, like ncurses or X11. |
|
Back to top |
|
|
TerraN0va n00b
Joined: 02 May 2004 Posts: 12
|
Posted: Mon Jul 30, 2007 8:47 am Post subject: |
|
|
epsxe is a X11 application, so it probably gets its keyboard input from X instead of ever reading your pipe. You need a program to "inject" keystroke events to epsxe.
I knew i had something like this once upon a time, but sadly can't quite remember what it was. |
|
Back to top |
|
|
manaka Apprentice
Joined: 23 Jul 2007 Posts: 178 Location: Spain
|
Posted: Tue Jul 31, 2007 8:01 pm Post subject: |
|
|
You need a program that reads from stdin and interacts with the X server (which will send the keystrokes to the application)...
You can try xautomation (x11-misc/xautomation)... You can type something like this in a X terminal...
Code: |
xte -x localhost:0 <<EOF
sleep 20
str Hello, world
EOF
|
Then make sure your desired window gets focus... And it will receive the keystrokes...
Maybe it's not what you exactly want... But it's close, I think...
Javi. _________________ Javier Miqueleiz
"Listen to your heart. It knows all things, because it came from the Soul of the World, and it will one day return there." |
|
Back to top |
|
|
|