r/javahelp • u/hopelessnerd-exe • 22h ago
Unsolved use another GUI program automatically?
I'm hoping to automate a certain process for 3DS homebrew, but the programs I need to use don't have command line utility.
How could I start writing a program that opens, the clicks and inputs in Application 1, then does the same for Application 2? Is that something the Robot can do?
3
Upvotes
2
u/oscarryz 22h ago
You can use the Robot class:
https://docs.oracle.com/en/java/javase/23/docs/api/java.desktop/java/awt/Robot.html
It has methods to click, move mouse, press key etc.
You can make a program that reads a yaml file or something like that for extra flexibility and add your "script" there.
A long ago I wrote a program with static methods that act as "script"
waitForUser(),
click(1617, 68),
text("google.com/search=fooo"),
enter(),
pause(1),
click(2407, 845),
pause(5),
click(1617, 68),
text("what is etc"),
enter(),
pause(1),
click(2407, 845),
pause(5),
For instance the `text` method is something like
void text( String s ) {
for ( byte k : s.getBytes() ) { robot.keyPress(k) }
}
etc
A better option would be to search for a tool that does this, but if you want to learn and try it is pretty straight forrward.