Created
January 7, 2024 00:07
-
-
Save micuat/b4e53996c2a203372456d8f100028fc5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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