Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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');
}
});
// Node.js application will not terminate until the readline.Interface is closed
// Called when close is called
terminal.on('close', function () {
process.exit(0);
});
usbPort.on('open', function () {
// stty -echo hides echoed response. stty echo shows response
writeSerial('stty -echo\r');
terminal.prompt();
});
robot.setMouseDelay(0);
usbPort.on('data', function (data) {
if (data != undefined) {
if (data.indexOf('{') == 0) {
// data is json
try {
jsonData = JSON.parse(data);
if (jsonData.uart) {
if (stylusEvent != null) {
stylusEvent.send('stylusRx');
}
} else if (jsonData.data) {
if (calibrating) {
calibrate(jsonData);
}
if (trained) {
var output = net.run({
async fullScreenOnMac() {
await robot.setMouseDelay(100);
await robot.moveMouseSmooth(205, 10);
await robot.mouseClick();
await robot.setKeyboardDelay(100);
// Key tap 5 times as "Enter Full Screen" is in the
// 5th position under view menu item
for (let i = 0; i < 5; i++) {
await robot.keyTap('down');
}
await robot.keyTap('enter');
}
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');
}
login(hostname) {
// Speed up the mouse.
robot.setMouseDelay(500);
const screenSize = robot.getScreenSize();
const height = screenSize.height;
const width = screenSize.width;
// fix keyboard layout
robot.keyToggle("space","down");
robot.keyToggle("space","up");
robot.moveMouse(width/2,height*0.56);
robot.mouseClick();
robot.moveMouse(width/2,height*0.68);
robot.mouseClick();
robot.keyToggle("a","down","control");
setTimeout(() => {
await this.app.browserWindow.getBounds().then(async (bounds) => {
await robot.setMouseDelay(100);
let x = bounds.x + 95;
let y = bounds.y + 35;
await robot.moveMouseSmooth(x, y);
await robot.moveMouse(x, y);
await robot.mouseClick();
await webAction.openApplicationMenuByClick();
await robot.setKeyboardDelay(1000);
await robot.keyTap('enter');
await robot.keyTap('down');
await robot.keyTap('down');
await robot.keyTap('right');
for (let i = 0; i < 6; 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 this.app.browserWindow.getBounds().then(async (bounds) => {
await robot.setMouseDelay(100);
let x = bounds.x + 95;
let y = bounds.y + 35;
await robot.moveMouseSmooth(x, y);
await robot.moveMouse(x, y);
await robot.mouseClick();
await webAction.openApplicationMenuByClick();
await robot.setKeyboardDelay(1000);
await robot.keyTap('enter');
await robot.keyTap('down');
await robot.keyTap('down');
await robot.keyTap('right');
for (let i = 0; i < 6; i++) {
await robot.keyTap('down');
}
await robot.keyTap('enter');
});