Created
June 7, 2018 06:44
-
-
Save prameshbajra/864ef9cdd2f52d3a7e71e1c5176ce46e to your computer and use it in GitHub Desktop.
Open a preferred application and start typing automatically.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.demo.advjava; | |
import java.awt.AWTException; | |
import java.awt.Robot; | |
import java.awt.event.KeyEvent; | |
import java.io.IOException; | |
public class NotepadFun { | |
public static void main(String[] args) throws IOException, InterruptedException, AWTException { | |
Runtime.getRuntime().exec("gedit"); | |
Thread.sleep(4000); | |
Robot r=new Robot(); | |
r.keyPress(KeyEvent.VK_T); | |
Thread.sleep(500); | |
r.keyPress(KeyEvent.VK_H); | |
Thread.sleep(500); | |
r.keyPress(KeyEvent.VK_I); | |
Thread.sleep(500); | |
r.keyPress(KeyEvent.VK_S); | |
Thread.sleep(500); | |
r.keyPress(KeyEvent.VK_SPACE); | |
Thread.sleep(500); | |
r.keyPress(KeyEvent.VK_I); | |
Thread.sleep(500); | |
r.keyPress(KeyEvent.VK_S); | |
Thread.sleep(500); | |
r.keyPress(KeyEvent.VK_SPACE); | |
Thread.sleep(500); | |
r.keyPress(KeyEvent.VK_F); | |
Thread.sleep(500); | |
r.keyPress(KeyEvent.VK_U); | |
Thread.sleep(500); | |
r.keyPress(KeyEvent.VK_N); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment