import java.io.*;
import java.awt.*;
import java.awt.event.*;
public class Robot1{
public static void main(String[] args) throws Exception{
Robot r = new Robot();
Runtime.getRuntime().exec("notepad");
Thread.sleep(1000);
typeLine("I know who you are",r,false);
r.delay(3000);
for(int i=0; i<=18; i++){
r.keyPress(KeyEvent.VK_BACK_SPACE);
r.keyRelease(KeyEvent.VK_BACK_SPACE);
r.delay(200);
}
r.keyPress(KeyEvent.VK_ALT);
r.keyPress(KeyEvent.VK_F4);
r.keyRelease(KeyEvent.VK_F4);
r.keyRelease(KeyEvent.VK_ALT);
}
public static void typeLine(String s,Robot robot,boolean enter) throws Exception{
char[] array=s.toCharArray();
for(int i=0;i<array.length;i++){
Thread.sleep(100);
if(array[i]>='a'&&array[i]<='z'){
robot.keyPress((int)array[i]-(int)'a'+65);
robot.keyRelease((int)array[i]-(int)'a'+65);
}else if(array[i]==' '){
robot.keyPress(KeyEvent.VK_SPACE);
robot.keyRelease(KeyEvent.VK_SPACE);
}else if(array[i]>='A'&&array[i]<='Z'){
robot.keyPress(KeyEvent.VK_SHIFT);
robot.keyPress((int)array[i]-(int)'A'+65);
robot.keyRelease((int)array[i]-(int)'A'+65);
robot.keyRelease(KeyEvent.VK_SHIFT);
}else if(array[i]>='0'&&array[i]<='9'){
robot.keyPress(KeyEvent.VK_SHIFT);
robot.keyPress(KeyEvent.VK_0+(int)(array[i]-'0'));
robot.keyRelease(KeyEvent.VK_0+(int)(array[i]-'0'));
robot.keyRelease(KeyEvent.VK_SHIFT);
}
}
if(enter){
robot.keyPress(KeyEvent.VK_ENTER);
robot.keyRelease(KeyEvent.VK_ENTER);
}
}
}