Repository navigation
Keyboard Functions
To easily use the keyboard:
const {keyboard} = jsautogui // jsautogui has to be defined
// or
import {keyboard} from "jsautogui" // modulejs
// or
const {keyboard} = require("jsautogui") // commonjsPresses a button on the keyboard. Check All Keys.
keyboard.press("a")
keyboard.press("a", "shift")Presses a button down on the keyboard and doesn't release back. Check All Keys.
keyboard.down("a")
keyboard.down("a", "shift")Releases a buttpn on the keyboard. Check All Keys.
keyboard.up("a")
keyboard.up("a", "shift")Writes text for the keyboard. Check All Keys.
keyboard.write("Hello, world!")
keyboard.write("Hello, world!", "I am alive!")Presses as a hotkey. First presses down all keys and releases them back up after pressing them all down. Check All Keys.
keyboard.hotkey("control", "c")
keyboard.hotkey("control", "v") // you are now officially a programmerYou can give in any ASCII or Unicode character as a key.
And here's a list of all possible modifier keys:
accept, add, alt, altleft, altright, apps, backspace, browserback, browserfavorites, browserforward, browserhome, browserrefresh, browsersearch, browserstop, capslock, clear, convert, ctrl, ctrlleft, ctrlright, decimal, del, delete, divide, down, end, enter, esc, escape, execute, f1, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f2, f20, f21, f22, f23, f24, f3, f4, f5, f6, f7, f8, f9, final, hanguel, hangul, hanja, help, home, insert, junja, kana, kanji, launchapp1, launchapp2, launchmail, launchmediaselect, left, modechange, multiply, nexttrack, nonconvert, num0, num1, num2, num3, num4, num5, num6, num7, num8, num9, numlock, pagedown, pageup, pause, pgdn, pgup, playpause, prevtrack, print, printscreen, prntscrn, prtsc, prtscr, return, right, scrolllock, select, separator, shift, shiftleft, shiftright, sleep, space, stop, subtract, tab, up, volumedown, volumemute, volumeup, win, winleft, winright, yen, command, option, optionleft, optionright