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

@deeean/sophia

v0.2.1

Published

<div align="center"> <h1>Sophia</h1> <p> <strong>🤖 A Node.js library for automating Windows applications.</strong> </p>

Downloads

7

Readme

NPM Version NPM License

Features

  • Keyboard
  • Mouse
  • Screen
  • Window
  • Memory

Installation

npm install @deeean/sophia

Example

Typing a string

import { Keyboard } from '@deeean/sophia';

async function main() {
  await Keyboard.typing('Hello, World!');
}

main();

Registering a hotkey for specific key combinations and handling events.

import { Keyboard, Modifiers, Key } from '@deeean/sophia';

Keyboard.registerHotkey([Modifiers.Control], Key.A, () => {
    console.log('Ctrl + A is pressed');
});

Finding the location of one image within another

import { readImageData, imageSearch } from '@deeean/sophia';

async function main() {
  const [
    baboon,
    partsOfBaboon,
  ] = await Promise.all([
    readImageData('./examples/images/baboon.png'),
    readImageData('./examples/images/parts_of_baboon.png'),
  ]);

  const position = await imageSearch(baboon, partsOfBaboon);
  if (position) {
    console.log('Found at', position);
  } else {
    console.log('Not found');
  }
}

main();

Finding the location of one image within the screenshot

import * as sophia from '@deeean/sophia';

async function main() {
  const [
    baboon,
  ] = await Promise.all([
    sophia.readImageData('./examples/images/baboon.png'),
  ]);

  const screenSize = await sophia.getScreenSize();
  const screenshot = await sophia.takeScreenshot(0, 0, screenSize.x, screenSize.y);

  const position = await sophia.imageSearch(screenshot, baboon);
  if (position) {
    console.log('Found at', position);
  } else {
    console.log('Not found');
  }
}

main();

Getting the list of processes and reading/writing memory

import { getProcesses, openProcess, ProcessAccess } from '@deeean/sophia';

const BASE_ADDRESS = BigInt(0x003264D0);
const OFFSETS = [
  BigInt(0x48),
  BigInt(0x0),
  BigInt(0xF8),
  BigInt(0x18),
  BigInt(0x408),
  BigInt(0x50),
  BigInt(0x7F8),
];

async function main() {
  const processes = await getProcesses();
  const tutorial = processes.find(p => p.name === 'Tutorial-x86_64.exe');
  if (!tutorial) {
    console.log('Tutorial-x86_64.exe not found');
    return;
  }

  const openedProcess = await openProcess(ProcessAccess.AllAccess, tutorial.pid);

  const health = await openedProcess.readMemoryChainUint32(BASE_ADDRESS, OFFSETS);
  if (health < 1000n) {
    await openedProcess.writeMemoryChainUint32(BASE_ADDRESS, OFFSETS, 1000n);
  }
}

main();

Supported Platforms

Only support Windows x64 for now.

Inspiration

I'm a big fan of AutoHotkey, but I want to use it in Node.js. So I decided to create a library that can automate Windows applications.

Related projects

License

Sophia is licensed under the MIT License. Feel free to use it in your projects, adhering to the license terms.