1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
import java.awt.Robot import java.awt.event.InputEvent import java.awt.event.KeyEvent fun main() { try { val robot = Robot() // Mover el mouse a las coordenadas (113, 215) y hacer clic izquierdo robot.mouseMove(113, 215) robot.mousePress(InputEvent.BUTTON1_MASK) robot.mouseRelease(InputEvent.BUTTON1_MASK) // Teclas para escribir "NOTE" val executeNotepad = intArrayOf(KeyEvent.VK_N, KeyEvent.VK_O, KeyEvent.VK_T, KeyEvent.VK_E, KeyEvent.VK_P) for (key in executeNotepad) { robot.delay(500) robot.keyPress(key) robot.keyRelease(key) } // Mover el mouse a las coordenadas (157, 258) y hacer clic izquierdo robot.mouseMove(157, 258) robot.mousePress(InputEvent.BUTTON1_MASK) robot.mouseRelease(InputEvent.BUTTON1_MASK) } catch (e: Exception) { e.printStackTrace() } } |