npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

automately

v1.0.3

Published

Native system automation for node.js

Downloads

24

Readme

🦄 Features

  • Automate mouse movements
  • Automate mouse clicks
  • Automate keyboard inputs

📦 Install AutoMately

Option 1: Install via npm

Install with npm if you plan to use automately in a Node project or in the browser.

npm install automately
const { keyboard, Key, mouse, Button, screen, Region } = require('automately');

⚡️ Using AutoMately

After you have followed the install step, you can start using automately to create custom text snippets that you can access on all of your devices

For a more in-depth documentation of this library and the AutoMately service, please visit the official AutoMately website.

⌨️ Keyboard Control

Configuration

  • autoDelayMs: Configures the delay between keypresses. Example:
    keyboard.config.autoDelayMs = 100;

keyboard.type(...keysOrText);

Types given keys or strings.

Example:

await keyboard.type(Key.LeftSuper, Key.Space);
await keyboard.type('calculator);

keyboard.pressKey(...keys);

Presses and holds multiple keys.

Example:

await keyboard.pressKey(Key.LeftAlt, Key.F4);
await keyboard.releaseKey(Key.LeftAlt, Key.F4);

keyboard.releaseKey(...keys);

Releases multiple keys.

Example:

await keyboard.pressKey(Key.LeftAlt, Key.F4);
await keyboard.releaseKey(Key.LeftAlt, Key.F4);

🖱 Mouse Control

Configuration

  • autoDelayMs: Configures the delay between mouse clicks and/or scrolls. Example:
    mouse.config.autoDelayMs = 100;
  • mouseSpeed: Configures mouse movement speed in pixels per second. Example:
    mouse.config.mouseSpeed = 1000;

mouse.setPosition(point);

Moves the mouse cursor to a given position instantly.

Example:

await mouse.setPosition(new Point(500, 500));

mouse.getPosition();

Returns a Promise resolving to the current cursor position.

Example:

const position = await mouse.getPosition();
console.log(position); // Point { x: 500, y: 500 }

mouse.move(path, movementFunction);

Moves the mouse cursor along a given path.

Example:

await mouse.move(straightTo(centerOf(await screen.find('image.png'))));

🖥 Screen Control

Configuration

  • confidence: Specifies the required matching percentage for image searching. Example:
    screen.config.confidence = 0.95;
  • autoHighlight: Enables automated highlighting of image search results. Example:
    screen.config.autoHighlight = true;
  • highlightDurationMs: Configures the duration of highlight window display. Example:
    screen.config.highlightDurationMs = 500;
  • highlightOpacity: Configures the opacity of highlight windows. Example:
    screen.config.highlightOpacity = 0.7;
  • resourceDirectory: Configures the asset directory for image resources. Example:
    screen.config.resourceDirectory = '/path/to/resources';

screen.capture(filePath);

Captures a screenshot and stores it to the filesystem.

Example:

await screen.capture('/path/to/screenshot.png');

screen.captureRegion(region, filePath);

Captures a screenshot of a specific region and stores it to the filesystem.

Example:

const region = new Region(0, 0, 100, 100);
await screen.captureRegion(region, '/path/to/region_screenshot.png');

screen.find(imageResource);

Finds a match for a given image on the screen.

Example:

await mouse.move(straightTo(centerOf(await screen.find('image.png'))));

screen.findAll(imageResource);

Finds all matches for a given image on the screen.

Example:

const matches = await screen.findAll('image.png');
for (const match of matches) {
    await mouse.move(straightTo(centerOf(match)));
}

screen.highlight(region);

Displays an opaque window overlay for easier visual follow-up.

Example:

await screen.highlight(await screen.find('image.png'));

screen.on(query, callback);

Registers callbacks executed upon finding a match for a template image.

Example:

const colorQuery = pixelWithColor(new RGBA(0, 0, 0, 255));
const secondQuery = pixelWithColor(new RGBA(43, 45, 48, 255));

screen.on(colorQuery, async (matchResult) => {
    await mouse.move(straightTo(matchResult.location));
});

screen.on(secondQuery, async (matchResult) => {
    console.log('Second query found');
});

await screen.find(colorQuery); // Triggers callback
await mouse.move(straightTo(new Point(100, 100)));
await screen.find(secondQuery); // Triggers callback
await screen.find(colorQuery); // Triggers callback again

screen.waitFor(imageResource, timeoutMs, intervalMs);

Waits for a match for a given image on the screen within a specified timeout.

Example:

await mouse.move(straightTo(centerOf(await screen.waitFor('image.png', 3000, 500))));

screen.colorAt(point);

Returns RGBA color information at a specified pixel location.

Example:

const color = await screen.colorAt(new Point(0, 0));
console.log(color); // RGBA { R: 0, G: 0, B: 0, A: 255 }

screen.width();

Returns the main screen's width in pixels.

Example:

const width = await screen.width();
console.log(width); // e.g. 1920

screen.height();

Returns the main screen's height in pixels.

Example:

const height = await screen.height();
console.log(height); // e.g. 1080

📝 What Can AutoMately do?

AutoMately is a free text snippet manager that lets you create custom text snippets that you can access on all of your devices!

🗨️ Final Words

If you are still having difficulty, we would love for you to post a question to the AutoMately issues page. It is much easier to answer questions that include your code and relevant files! So if you can provide them, we'd be extremely grateful (and more likely to help you find the answer!)

📚 Projects Using this Library

Ask us to have your project listed! :)