r/javahelp • u/NiteBiker6969 • Dec 26 '19
Would it be possible to write a java program that can clone all mouse and keyboard inputs on one window to another background window?
Let's just say I'm on one window doing stuff with my keyboard and mouse, I want the program to basically clone everything I've done and send these simulated events to a background window.
1
Dec 27 '19
It sounds like you're trying to hack someone rather than creating something with code.
Please don't.
If that's not the case, the use case seems odd enough, what are you trying to do?
1
u/NiteBiker6969 Dec 27 '19
To clear the confusion. Im writing a program to ultimately allow me to multibox in league. Thats why I wanted to forst write a program to control two different chrome windows at the same time.
1
2
u/irocgts Dec 26 '19 edited Dec 26 '19
Yeah it's possible. If these windows are exactly the same.
You'd have to use some windows dlls. I think it's called JNI. You'll be able to click the same buttons and enter text in the same text boxes and whatnot. There is a few DLLs that mimic mouse and keyboard commands to specific windows and elements in windows.
I am being vague because I don't have all the info. I am on my phone in Panama.
1
u/turunambartanen Dec 26 '19
You probably mean JNI? https://en.wikipedia.org/wiki/Java_Native_Interface
1
1
u/7Point1 Extreme Brewer Dec 27 '19
I cannot help you in regards to actual production but I can shed some light on a similar program I found last night:
IOGraphica is a cute little program that records mouse movements and spits out a piece of art a few hours later. This is achieved via MousePath which is open source, developed using java, and can be downloaded from here. I had a 2s look at the source code and MousePath seems to be built with a language/library/IDE called Processing which is developed using the class called "PApplet.java".
On the other hand if you're looking for a program to simply do a repetitive task what about something in the same vein as AutoHotKey (AHK)?
Maybe not exactly what you're looking for, but hope these lead you somewhere.
1
u/turunambartanen Dec 26 '19
If you write both Windows yourself in e.g. Java that's relatively easy. If not I have no idea how it would be done.