-2
I have a code and need to write the value of a variable through the robot class, for example:
int camera=2
Robot robot = new Robot();
robot.keyPress(KeyEvent.VK_C);
robot.keyPress(KeyEvent.VK_A);
robot.keyPress(KeyEvent.VK_M);
robot.keyPress(KeyEvent.VK_E);
robot.keyPress(KeyEvent.VK_R);
robot.keyPress(KeyEvent.VK_A);
I care about the value that comes next to the word, I want the value of the variable to be written, can be varied throughout the code.
Isn’t it easier to monitor the entire word at once rather than letter by letter? If I write "cdamehera" its algorithm will count as camera too.
– user28595
The rest of the code doesn’t really matter, what I really need is to learn how to take the variable and type its value elsewhere.
– Lucas Moraes de Souza
Yes, but since it is not very clear what this code should do, and as there is no way to execute, it is difficult to suggest something.
– user28595
It has to do exactly what you are seeing, write "camera1", then it will add 1 in the variable and will have to write "camera2", as many times as necessary.
– Lucas Moraes de Souza