Skip to content
This repository has been archived by the owner on Mar 8, 2024. It is now read-only.

how to realize VK_COMMAND for macos (keyboard) in KeyEvent.java? #37

Open
yezhengli-Mr9 opened this issue Sep 24, 2023 · 1 comment
Open

Comments

@yezhengli-Mr9
Copy link

how to realize VK_COMMAND for macos (keyboard) in KeyEvent.java?

https://stackoverflow.com/questions/15418987/java-robot-keypress-command-key
VK_META seems not work.

@yezhengli-Mr9
Copy link
Author

yezhengli-Mr9 commented Sep 24, 2023

    for(int KV_COMMAND =10;KV_COMMAND < 6000;KV_COMMAND++){
            DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss");  
           LocalDateTime now = LocalDateTime.now();  
           System.out.println("KV_COMMAND "+KV_COMMAND +"\t"+ dtf.format(now));  
            robot.keyPress(KV_COMMAND);
            // robot.keyPress(KeyEvent.VK_CONTROL);
            robot.keyPress(KeyEvent.VK_S);
            robot.keyRelease(KeyEvent.VK_S);
            robot.keyRelease(KV_COMMAND);
            robot.delay(4000);
            robot.keyRelease(KeyEvent.VK_ENTER);
            robot.delay(4000);
     }

but did not find/ detect that key map for command in macbook.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant