Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
serenade-driver
Advanced tools
A collection of utilities for implementing cross-platform low-level system automations. Check out the test
directory for example usages.
This module is used by Serenade, the most powerful way to write code using natural speech. For more, see https://serenade.ai.
All functions in this module return Promise
objects that will be fulfilled when system calls complete. So, you can either await
each function, or use then
to attach a callback when they complete.
Trigger a mouse click.
button <string>
Mouse button to click. Can be left
, right
, or middle
.count <number>
How many times to click. For instance, 2
would be a double-click, and 3
would be a triple-click.<Promise>
Fulfills with undefined
upon success.Click a native system button matching the given text. Currently macOS only.
button <string>
Button to click. This value is a substring of the text displayed in the button.<Promise>
Fulfills with undefined
upon success.Bring an application to the foreground.
application <string>
Application to focus. This value is a substring of the application's path.<Promise>
Fulfills with undefined
upon success.Get the path of the currently-active application.
<Promise<string>>
Fulfills with the name of the active application upon success.Get a list of all of the buttons that can currently be clicked (i.e., are visible in the active application). Currently macOS only.
<Promise<string[]>>
Fulfills with a list of button titles upon success.Get the text and cursor position of the currently-active text field. Currently macOS only.
<Promise<{ text: string, cursor: number }>>
Fulfills with text field data upon success.Get a list of applications installed on the system.
<Promise<string[]>>
Fulfills with a list of application paths upon success.Get the current (x, y) coordinates of the mouse.
<Promise<{ x: number, y: number }>>
Fulfills with the location of the mouse upon success.Get a list of currently-running applications.
<Promise<string[]>>
Fulfills with a list of application paths upon success.Launch an application.
application <string>
Substring of the application to launch.<Promise>
Fulfills with undefined
upon success.Press the mouse down.
button <string>
Mouse button to press. Can be left
, middle
, or right
.<Promise>
Fulfills with undefined
upon success.Release a mouse press.
button <string>
Mouse button to release. Can be left
, middle
, or right
.<Promise>
Fulfills with undefined
upon success.Press a key on the keyboard, optionally while holding down other keys.
key <string>
Key to press. Can be a letter, number, or the name of the key, like enter
, backspace
, or comma
.modifiers <string[]>
List of modifier keys to hold down while pressing the key. Can be one or more of control
, alt
, command
, option
, shift
, or function
.count <number>
The number of times to press the key.<Promise>
Fulfills with undefined
upon success.Quit an application.
application <string>
Substring of the application to quit.<Promise>
Fulfills with undefined
upon success.Run a command at the shell.
command <string>
Name of the executable to run.args <string[]>
List of arguments to pass to the executable.options <object>
Object of spawn arguments. Can simply be {}
. See https://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options for more.<Promise<{ stdout: string, stderr: string }>>
Fulfills with the output of the command upon success.Set the text and cursor position of the currently-active editor. Currently macOS only.
text <string>
New editor content.cursor <number>
New editor cursor position.<Promise>
Fulfills with undefined
upon success.Move the mouse to the given coordinates, with the origin at the top-left of the screen.
x <number>
x-coordinate of the mouse.y <number>
y-coordinate of the mouse.<Promise>
Fulfills with undefined
upon success.Type a string of text.
text <string>
Text to type.<Promise>
Fulfills with undefined
upon success.To build the library, simply run:
yarn
Then, to test, you can run:
node test/test.js
That test file will simulate a bunch of keystrokes, so if your computer looks like it's going crazy, don't worry. Probably.
FAQs
A library for cross-platform system automations.
The npm package serenade-driver receives a total of 2 weekly downloads. As such, serenade-driver popularity was classified as not popular.
We found that serenade-driver demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.