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

sendkeys-macos

v1.3.0

Published

Sends keystrokes to a given application with customizable delays to simulate typing

Downloads

49

Readme

Notice

I've rewritten this tool using Swift (sendkeys) and can be installed using homebrew:

brew install socsieng/tap/sendkeys

It includes expanded support for mouse commands.

I am no longer maintaining this library and encourage you to use the Swift version instead.

SendKeys for macOS

This is a CLI tool to send keys to a given app to simulate typing at a given speed.

This tool was originally created to make it easier to enter keystrokes for a smooth screen recording of code being typed in.

Includes experimental support for mouse operations.

Installation

npm install sendkeys-macos --global

npm install animation example

CLI usage

Basic usage:

sendkeys -a "Notes" -c "Hello<p:1> world<c:left:option,shift><c:i:command>"

hello world example

Providing input from a file:

sendkeys -a "Visual Studio Code" -f example.txt

Receiving input from stdio:

cat example.txt | sendkeys -a "Notes"

Refer to the help command for more options:

sendkeys --help

Node usage

Programatic usage:

const sendKeys = require('sendkeys-macos');

sendKeys('Notes', 'hello<c:a:command><c:c:command><c:right> <c:v:command>', { delay: 0.1, initialDelay: 1 });

hello hello example

Markup instructions

Basic markup is supported to control the pause between keystrokes and to apply additional keystroke combinations.

Inserting a pause

A pause can be inserted with the <p:seconds> sequence.

By default, the delay between keystrokes is set with the -d or --delay option where the default is 0.1 seconds. A one-off pause of 1 second can be applied between characters by inserting <p:1>.

<P:seconds> (note upper case P) can be used to modify the default delay between subsequent keystrokes.

Special key combinations

Special key combinations including non-printable character sequences can be applied using the <c:key> or <c:key:modifiers> markup.

key can include any printable character or, one of the following key names: f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, esc, return, enter, delete, space, tab, up, down, left, right, home, end, pgup, and pgdown.

modifiers is an optional list of comma separated values that can include command, shift, control, and option.

Example key combinations:

  • tab: <c:tab>
  • command + a: <c:a:command>
  • option + shift + left arrow: <c:left:option,shift>

Mouse commands

Experimental support for mouse commands, including:

  • Mouse move: <m:x1,y1,x2,y2:duration_in_seconds>
  • Mouse click: <m:button:number_of_clicks>
    • button supported values left, center, right.
    • number_of_clicks defaults to 1
  • Mouse drag: <d:x1,y1,x2,y2:duration_in_seconds:button>
    • button supported values left, center, right. Defaults to left.

Continuation

A continuation can be used to ignore the next character. This is useful to help with formatting a long sequence of character and inserting a new line for authoring purposes.

Insert a continuation using the character sequence <\>. The character following the sequence will be skipped over.

Prerequisites

This script only works on macOS as it has a dependency on the macOS Automator application.

When running from the terminal, ensure that the terminal has permissions to send keystrokes. This can be done by navigating to System Preferences > Security & Privacy > Privacy > Accessibility and adding your terminal application there.