Results 1 to 8 of 8
Hi
I have a program that receive user input.
I want to run this program automatically without user interaction, and in order to do that I need to simulate key ...
- 02-03-2011 #1Just Joined!
- Join Date
- Feb 2011
- Posts
- 8
How can I simulate key strokes events in other processes in linux?
Hi
I have a program that receive user input.
I want to run this program automatically without user interaction, and in order to do that I need to simulate key events.
How can I do such a thing?
The program I am running is partly java and partly shell.
The shell part is easily done by using:
./prog.sh <parameters (Parameters being a file containing parameters)
But the java doesn't work similarly.
Thanks
Ron
- 02-03-2011 #2
if your program reads from stdin it should work.
- 02-03-2011 #3Just Joined!
- Join Date
- Feb 2011
- Posts
- 8
Doesn't work in a multy threaded application
Hi
Thank you for your response
The java program I am trying to run automatically open a several threads.
I tried it on a simple basic jar and it did work, but in a case of a multithreaded environment it doesn't.
- 02-03-2011 #4
I can't see why that shouldn't work either. Of course you cannot dispatch stdin input in multithreading, but that just means you need a single threaded dispatcher who distributes the commands properly.
EDIT: well, thinking about it you can even do that but you would have to replicate the input stream for each worker such that they don't "eat" each others tokens from stdin. anyway it would be quite odd and can be exploited drastically.
- 02-03-2011 #5Just Joined!
- Join Date
- Feb 2011
- Posts
- 8
I'm not sure I fully understand your suggestion, how can I distribute it to threads?
Let me point out that I am not sure how the application I am trying to automatically run is implemented, I do know that it got a console and gui mode (I am working on the console mode) and therefore I assume that these different panels are seperate threads.
When running it, I receive one input request at a time.
Thanks
Ron
- 02-04-2011 #6
oh, you have no source code. well, that's troublesome.
plain theoretical it would be something like piping either all or some of the stdin to logical workers inside the application, thus creating kind of a ESB.
how do you know that there are multiple threads? doing stuff with a blackbox is always a bit nasty and troublesome. so you may wanna try decompiling the java bytecode using jadclipse or similar projects to get a better understanding of how it works?
- 02-06-2011 #7Just Joined!
- Join Date
- Feb 2011
- Posts
- 8
Found the solution
Hi
Thanks for your assistance
I found the solution in a unix command called "expect"
- 02-07-2011 #8
Oh, nice. Didn't know that.
Added to bookmarks. Thanks!


Reply With Quote