octalmage / robotjs

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

multi-monitor keyboard inputs #553

Closed MitchellMonaghan closed 4 years ago

MitchellMonaghan commented 4 years ago

I am using puppeteer and robotjs together. I have a browser open and being controlled with puppeteer on my main monitor. I have my node script running on my second monitor with some video recording software. The video recording software is setup to start recording on insert key press and is only recording my main monitor.

When I run my node script the recording only seems to start if my mouse was on my main monitor. I can manually push the video recording software hotkey on any monitor and it works fine so this makes me think this is a issue with robotjs. If my mouse is on my second monitor no key press commands seem to be sent by robotjs/received by my recording software.

I saw this issue I'm not sure if they are related. https://github.com/octalmage/robotjs/issues/88

"robotjs": "^0.6.0", "puppeteer-core": "^2.1.1", node v10.15.1

Video Recording software Streamlabs OBS Version 0.20.1

I might look further into what the issue is just figured I would log the bug/get feedback. Some code I was using for this.

    const browser = await puppeteer.connect({
      browserURL: 'http://127.0.0.1:9222'
    })

    const page = await browser.newPage()
    await page.setViewport({ width: 1920, height: 1080 })
    await page.on('close', () => process.exit())

    await page.goto('https://www.google.com')

    await page.waitFor(3000)

    console.log('start recording')
    robot.keyTap('insert')

    await sleep(5000)

    robot.keyTap('insert')
MitchellMonaghan commented 4 years ago

Never mind this seems to be caused by something else I have modified my code and I can't reproduce it anymore I think it was a timing issue/sending to many inputs the the browser.