Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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');
}
return;
}
// Application Init
let mainWindow = null; // Main application window
let errorWindow = null; // Config load error window
let portWindow = null; // Config load error window
let config = null; // Main settings object
let forceQuit = null; // Bool to force quit app from tray
app.setAppUserModelId('com.squirrel.ControlCast.ControlCast');
const configFile = path.join(process.cwd(), '../config.json'); // Set config file path
robot.setKeyboardDelay(50); // Set delay for each keypress for OBS
global.app_version = require('../package.json').version; // Store app version for in app displays
global.release_url = require('../package.json').releaseUrl; // Store releaseUrl for update queries
app.on('window-all-closed', () => { // Quit when all windows are closed.
if (process.platform !== 'darwin') app.quit();
});
app.on('ready', () => { // Application has finished loading
fs.exists(configFile, exist => { // Check if config files already exists
if (!exist) { // config.json does not exist
config = getDefaultConfig(); // Get config defaults
saveConfig(); // Save config file
createMainWindow(); // Load Main Window
} else { // config.json files already exists
try {
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');
}
var interval = setInterval(function() {
// Send chat message if PoE is focused
if(app.poeFocused && clipboard.readText() === message) {
clearInterval(interval);
robot.setKeyboardDelay(0);
robot.keyToggle("enter", "down");
robot.keyToggle("enter", "up");
robot.keyToggle("control", "down");
robot.keyToggle("v", "down");
robot.keyToggle("v", "up");
robot.keyToggle("control", "up");
if(send) {
robot.keyToggle("enter", "down");
robot.keyToggle("enter", "up");
}
// Restore clipboard content
var timeout = setTimeout(function() {
clipboard.writeText(previousClipboard);
}, 100);
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 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');
});
}
await this.app.browserWindow.getBounds().then(async (bounds) => {
await robot.setMouseDelay(500);
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(200);
await robot.keyTap('enter');
for (var i = 0; i < arrMenu.length; i++) {
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');
});
}
module.exports = {};
var robot = require('robotjs');
var KEYS = require('./Enums').KEYS;
var behaviors = require('./Behaviors').functions;
var KeyHandler = require('./behaviors/KeyHandler');
var FunctionLibrary = require('./FunctionLibrary');
var MAX_INPUT_THUMBSTICK = require('./Enums').MAX_INPUT_THUMBSTICK;
var Logger = require('./Logger');
var RepeatActionInterval = 90;
robot.setMouseDelay(0);
robot.setKeyboardDelay(0);
function ResolveDpadInput(data, DpadMapping, InputMapping, BehaviorMapping, skipKeyUp) {
var buttons = parseInt(data / 4) * 4;
switch (buttons) {
case KEYS.DPAD_UP:
ActivateKey(DpadMapping, InputMapping, BehaviorMapping, KEYS.DPAD_UP, true, skipKeyUp);
for (var i = 12; i <= 28; i = i + 8) {
ActivateKey(DpadMapping, InputMapping, BehaviorMapping, i, false, skipKeyUp);
}
break;
case KEYS.DPAD_RIGHT:
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');