Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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');
}
}
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');
}
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');
}
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');
}
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)
}
}
})
})
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');
}
keyTap(key, modifiers) {
if (!this.settingsHandler.enableRealtimeStrokes || !key) {
return;
}
robotjs.keyTap(key, modifiers);
}
setTimeout(() => {
robot.typeString(hostname);
robot.keyTap("enter");
},100)
},100);
function simulateCopy() {
robot.keyTap("C", "control");
}