Skip to content

Instantly share code, notes, and snippets.

@micuat
Created January 7, 2024 00:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save micuat/b4e53996c2a203372456d8f100028fc5 to your computer and use it in GitHub Desktop.
Save micuat/b4e53996c2a203372456d8f100028fc5 to your computer and use it in GitHub Desktop.
import robot from "robotjs";
import { Command } from 'commander';
const program = new Command();
program
.option('-n, --number <number>', 'specify numbers');
program.parse();
const delay = ms => new Promise(resolve => setTimeout(resolve, ms));
await delay(5000);
const N = parseInt(program.opts().number);
console.log(`N = ${ N }`);
for (let k = 0; k < N; k++) {
for (let j = 0; j < N; j++) {
for (let i = 0; i < N; i++) {
robot.keyTap(i + 1);
}
robot.keyTap("right");
}
for (let j = 0; j < N; j++) {
robot.keyTap("left");
}
robot.keyTap("down");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment