Comments (8)
I think I'll create a new method for getting the screen size so it's not slowed down by getting the mouse position. The internal C function getMainDisplaySize()
does what you want, it will be very easy to expose it to Node.js (with a new name).
I'll try to get this added tonight!
from robotjs.
Sorry, thought I replied to this. I added getScreenSize
:
var robot = require("robotjs");
var screen = robot.getScreenSize();
console.log(screen.width + "x" + screen.height);
I released RobotJS v0.1.2 with this function, update and let me know how it works!
from robotjs.
Perfect! Thank you, @octalmage!
from robotjs.
from robotjs.
Good day.
the function to obtain the screen size in macOS does not operate, the result it shows is 0 in width as in height
`var robot = require("robotjs");
// Speed up the mouse.
robot.setMouseDelay(10);
var twoPI = Math.PI * 2.0;
var screenSize = robot.getScreenSize();
console.log(screenSize);
var height = 768;
var width = 1366;
for (var x = 0; x < width; x++) {
y = height * Math.sin((twoPI * x) / width) + height;
robot.moveMouse(x, y);
}`
from robotjs.
I've got the same issue! Does somebody know how to solve this?
from robotjs.
Same issue... any fixes?
from robotjs.
If I use NVM to switch to Node v10.23.1
it works. (I use MacOS Catalina 10.15.7)
So apparently there was a change in NodeJS itself that broke robot.getScreenSize()
and thus also mouse clicks? 🤔
Note: I didn't investigate at which version it started to break, v10.23.1 was just the one I already had in NVM.
from robotjs.
Related Issues (20)
- Multiple compile warnings and an error in 0.6.0 with node 16.14.2 - error in mouse.c HOT 3
- How to stop moveMouseSmooth?
- i hope one day u implement Image search HOT 1
- Returned image buffer has Red and Blue channels swapped [b, g, r, a] HOT 1
- mouseMove 960, 540 does not move to center of screen 1920x1080 HOT 2
- How to make screen of visible window on macos? HOT 2
- git clone npm i why error HOT 1
- All key events continuously hold down keys on Windows only. HOT 1
- Does not work on windows 11 HOT 1
- Using the typeString() method does not let you find the name of a file.
- Installing for nw.js - "A dynamic link library (DLL) initialization routine failed."
- Robotjs doesn't work with Electron, current time 2023.11.27 HOT 3
- or
- In the multi-instance tool, RobotJS is not working. There are no issues with reading properties, but moving the mouse or pressing the keyboard is not functioning correctly.
- Is there anyway to use this library in Nextjs app
- I cannot install robotjs HOT 5
- UTF-8 client type string HOT 1
- Focused program does not react to keyup event
- Mouse is not moving when using Remote Desktop Connection with Windows HOT 1
- Badges on README.md are broken
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from robotjs.