Skip to content

Commit

Permalink
sleep adjust
Browse files Browse the repository at this point in the history
  • Loading branch information
gabriel-archanjo committed Mar 25, 2021
1 parent e277e8e commit d58be1f
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/main/java/dev/botcity/framework/bot/DesktopBot.java
Original file line number Diff line number Diff line change
Expand Up @@ -926,17 +926,21 @@ public void maximizeWindow() {
* Press a sequence of keys. Hold the keys in the specified order, then release them.
* @param keys array of key identification values like KeyEvent.VK_ENTER
*/
public void typeKeys(Integer... keys) {
public void typeKeys(Integer interval, Integer... keys) {
typeKeysWithInterval(100, keys);
}

public void typeKeysWithInterval(Integer interval, Integer... keys) {
// Press
for(int i=0; i<keys.length; i++){
robot.keyPress(keys[i]);
sleep(100);
sleep(interval);
}

// release
for(int i=keys.length-1; i>=0; i--){
robot.keyRelease(keys[i]);
sleep(100);
sleep(interval);
}
}

Expand Down

0 comments on commit d58be1f

Please sign in to comment.