octalmage / robotjs

Node.js Desktop Automation.
http://robotjs.io
MIT License
12.26k stars 937 forks source link

Robotjs in Electron docs #681

Open AndreiSoroka opened 3 years ago

AndreiSoroka commented 3 years ago

Expected Behavior

When I run node script:

const robot = require('robotjs');

setTimeout(() => {
  const mouse = robot.getMousePos();

  // Get pixel color in hex format.
  const hex = robot.getPixelColor(mouse.x, mouse.y);
  console.log(`#${hex} at x:${mouse.x} y:${mouse.y}`);
}, 1000);

I get modal message (dialog, popup):

image

But when I try to do it in electron@9.4.4. Just nothing. No errors. No modals to ask access permission. Just not work.

Possible Solution

I think need to add to documentation: "how setup electron".

For example here: http://robotjs.io/docs/electron

Context

I would like add paste event to my electron app in other apps;

 robot.keyTap('v', process.platform==='darwin' ? 'command' : 'control')

Your Environment

AndreiSoroka commented 3 years ago
    <key>com.apple.security.cs.disable-library-validation</key>
    <true/>
    <key>com.apple.security.cs.disable-executable-page-protection</key>
    <true/>

not helped

from https://stackoverflow.com/questions/63307240/signed-electron-app-does-not-start-with-robotjs-on-osx-unhandled-errpr-no-suit and from https://github.com/octalmage/robotjs/issues/515#issuecomment-573347510