Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.Robot;
- import java.awt.event.KeyEvent;
- import java.awt.AWTException;
- import java.nio.file.*;
- void setup() {
- String pathToVideo = "D:\\Videos\\Desktop";
- try {
- long preFileCount = Files.list(Paths.get(pathToVideo)).count();
- Robot robot = new Robot();
- // Simulate a key press
- robot.keyPress(KeyEvent.VK_ALT);
- robot.keyPress(KeyEvent.VK_F9);
- robot.keyRelease(KeyEvent.VK_F9);
- robot.keyRelease(KeyEvent.VK_ALT);
- delay(2000); //make sure that geforce experience had time to start/stop recording
- long postFileCount = Files.list(Paths.get(pathToVideo)).count();
- if(postFileCount == preFileCount) {
- //then we stopped the video and should hit alt+f9 again to start recording a new file
- // Simulate a key press
- robot.keyPress(KeyEvent.VK_ALT);
- robot.keyPress(KeyEvent.VK_F9);
- robot.keyRelease(KeyEvent.VK_F9);
- robot.keyRelease(KeyEvent.VK_ALT);
- }
- // new File(<directory path>).list().length
- String[] cmd = { "D:\\Projects\\social_dinner_runnable\\social_dinner_runnable.exe", "-sendInvites" };
- //String[] cmd = { "D:\\Projects\\social_dinner_runnable\\social_dinner_runnable.exe -sendInvites" };
- Process p = Runtime.getRuntime().exec(cmd);
- p.waitFor();
- }
- catch (AWTException e) {
- e.printStackTrace();
- }
- catch (IOException e) {
- e.printStackTrace();
- }
- catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement