How to use the robotjs.keyTap function in robotjs

To help you get started, we’ve selected a few robotjs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ivanseidel / IAMDinosaur / GameManipulator.js View on Github external
GameManipulator.reloadPage = function ()
{
  // retrieves platform
  var platform = process.platform;

  if(/^win/.test(process.platform)) {
    robot.keyTap('r','control');
  } else if(/^darwin/.test(process.platform)) {
    robot.keyTap('r','command');
  }
}
github symphonyoss / SymphonyElectron / spec / spectron / spectronWindowsActions.js View on Github external
async doAlwaysOnTopOnMac() {
        await robot.setMouseDelay(500);
        await robot.moveMouse(190, 0);
        await robot.mouseClick();
        // Key tap 7 times as "Always on Top" is in the
        // 7th position under view menu item
        for (let i = 0; i < 7; i++) {
            await robot.keyTap('down');
        }
        await robot.keyTap('enter');
    }
github symphonyoss / SymphonyElectron / tests / spectron / spectronWindowsActions.js View on Github external
async actionForMenusOnMac(arrMenu) {
        let webAction = await new WebActions(this.app);
        await robot.setMouseDelay(2000);
        let x = 5;
        let y = 5;
        await robot.moveMouseSmooth(x, y);
        await robot.moveMouse(x, y);
        await robot.mouseClick();
        await robot.setKeyboardDelay(100);
        for (var i = 0; i < arrMenu.length; i++) {
            if (i == 0) {
                for (var s = 0; s < arrMenu[i].step; s++) {

                    await robot.keyTap('right');
                }
            }
            else {
                for (var s = 0; s <= arrMenu[i].step; s++) {

                    await robot.keyTap('down');
                }
            }
            if (arrMenu.length > 1 && i != arrMenu.length - 1) {
                //handle right keygen
                await robot.keyTap('right');
            }
        }
        await robot.keyTap('enter');
    }
github symphonyoss / SymphonyElectron / tests / spectron / spectronWindowsActions.js View on Github external
for (var i = 0; i < arrMenu.length; i++) {
            if (i == 0) {
                for (var s = 0; s < arrMenu[i].step; s++) {

                    await robot.keyTap('right');
                }
            }
            else {
                for (var s = 0; s <= arrMenu[i].step; s++) {

                    await robot.keyTap('down');
                }
            }
            if (arrMenu.length > 1 && i != arrMenu.length - 1) {
                //handle right keygen
                await robot.keyTap('right');
            }
        }
        await robot.keyTap('enter');
    }
github fritx / nw-remote / src / client.js View on Github external
if (data.keyCode) {
        let k = vkey[data.keyCode].toLowerCase()
        if (k === '') k = ' '
        const modifiers = []
        if (data.meta) modifiers.push('command')
        if (data.ctrl) modifiers.push('control')
        if (data.alt) modifiers.push('alt')
        if (data.shift) modifiers.push('shift')
        if (k[0] !== '<') {
          console.log('typed ' + k + ' ' + JSON.stringify(modifiers))
          if (modifiers[0]) robot.keyTap(k, modifiers[0])
          else robot.keyTap(k)
        } else {
          if (k === '') robot.keyTap('enter')
          else if (k === '') robot.keyTap('backspace')
          else if (k === '') robot.keyTap('up')
          else if (k === '') robot.keyTap('down')
          else if (k === '') robot.keyTap('left')
          else if (k === '') robot.keyTap('right')
          else if (k === '') robot.keyTap('delete')
          else if (k === '') robot.keyTap('home')
          else if (k === '') robot.keyTap('end')
          else if (k === '') robot.keyTap('pageup')
          else if (k === '') robot.keyTap('pagedown')
          else console.log('did not type ' + k)
        }
      }
    })
  })
github symphonyoss / SymphonyElectron / spec / spectron / spectronWindowsActions.js View on Github external
let y = 5;
        await robot.moveMouseSmooth(x, y);
        await robot.moveMouse(x, y);
        await robot.mouseClick();
        await robot.setKeyboardDelay(100);
        for (var i = 0; i < arrMenu.length; i++) {
            if (i == 0) {
                for (var s = 0; s < arrMenu[i].step; s++) {

                    await robot.keyTap('right');
                }
            }
            else {
                for (var s = 0; s <= arrMenu[i].step; s++) {

                    await robot.keyTap('down');
                }
            }
            if (arrMenu.length > 1 && i != arrMenu.length - 1) {
                //handle right keygen
                await robot.keyTap('right');
            }
        }
        await robot.keyTap('enter');
    }
github fttx / barcode-to-pc-server / electron / src / handlers / scans.handler.ts View on Github external
keyTap(key, modifiers) {
        if (!this.settingsHandler.enableRealtimeStrokes || !key) {
            return;
        }
        robotjs.keyTap(key, modifiers);
    }
github PrismarineJS / node-minecraft-wrap / lib / client_control.js View on Github external
setTimeout(() => {
        robot.typeString(hostname);
        robot.keyTap("enter");
      },100)
    },100);
github CopyTranslator / CopyTranslator / src / tools / simulate.ts View on Github external
function simulateCopy() {
  robot.keyTap("C", "control");
}