Utilities | raspberry pi | scraping | Search

robot

node screenshots

The screenshotMonitor function captures a screenshot of a specified monitor, resizes it, and returns it as a PNG buffer, using the screenshot-desktop and sharp modules to handle image processing and capture.

node window screenshot

The code requires the node-screenshots library and exports a single function, screenshotWindow, which takes a window argument and returns a PNG screenshot of the corresponding desktop application window. The function identifies and captures the window, converts the image to PNG format, and returns it as the result.

get screen size

The getScreenSize function is used to retrieve the current size of the screen, and it can be accessed from other JavaScript files by importing the module. The module is exported using module.exports = getScreenSize.

move mouse

The moveMouse function moves the mouse cursor to a specified position on the primary monitor by scaling the input coordinates and using the mouse-controller library. It requires the node-screenshots library to get the list of monitors.

mouse click

The clickMouse function uses the node-screenshots and mouse-controller modules to simulate a left mouse click at a specified position (x, y) on the primary monitor. This function is exported as a module, making it available for use in other scripts.

send keys

The keySend function is designed to simulate typing a string on the keyboard with optional special key presses, using the robotjs library to interact with the mouse and keyboard. The function takes a string to be typed and an array of special keys to be pressed, and uses a loop to simulate typing the string with realistic timing and modifier key presses.

mouse control cocoa

This code simulates mouse events using Core Graphics and Core Foundation frameworks, allowing for functions to set the mouse position, simulate mouse button clicks, and retrieve the current mouse position. It uses a combination of C-style includes and C++ code, suggesting it may be a wrapper around C code, to create a comprehensive mouse simulation tool.