octalmage / robotjs

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

scrollMouse(x, y) is not working in Windows 10 #663

Open akanshSirohi opened 3 years ago

akanshSirohi commented 3 years ago

Expected Behavior

robot.scrollMouse(0, 100); // It should scroll the screen upwards

Current Behavior

robot.scrollMouse(0, 100); // Doing nothing...

Steps to Reproduce (for bugs)

  1. Rebuilt RobotJS for ElectronJS with the following command npm rebuild --runtime=electron --target=12.0.4 --disturl=https://atom.io/download/atom-shell --abi=48
  2. Run
    const robot = require("robotjs");
    robot.scrollMouse(0, 100);

Context

Using RobotJS in desktop automation application built in ElectronJS

Your Environment

zhangshaoju1987 commented 3 years ago

you should focus first. eg. moveMouse to target and then troggleMouse down ,and final do scrollMouse

akanshSirohi commented 3 years ago

I found the working solution for this, and this is successfully tested on Windows 10. Make the following changes in file mouse.c. On line 335 replace

mouseScrollInputs[0].mi.mouseData = y;

with

mouseScrollInputs[0].mi.mouseData = -x;

And on line 344 replace

mouseScrollInputs[1].mi.mouseData = -x;

with

mouseScrollInputs[1].mi.mouseData = y;
AkasaHakase commented 1 year ago

实际上在今天scrollMouse在win上面没有做什么操作

favour1025 commented 2 months ago

I modified the code corresponding to the mouse.c file according to your prompt, but it did not achieve the expected effect.(windows 10)