格式
This commit is contained in:
parent
64f62be356
commit
7081eae1a3
@ -5,8 +5,8 @@ const POWER_SHELL = 'powershell -NoProfile -Command';
|
||||
function getMousePos() {
|
||||
const cmd = `${POWER_SHELL} "Add-Type -AssemblyName System.Windows.Forms; [System.Windows.Forms.Cursor]::Position"`;
|
||||
const output = execSync(cmd, { windowsHide: true }).toString();
|
||||
const match = output.match(/X=(\d+).*Y=(\d+)/);
|
||||
if (!match) throw new Error('Failed to get mouse position');
|
||||
const match = output.match(/(\d+)\s+(\d+)\s*$/m);
|
||||
if (!match) throw new Error('Failed to get mouse position: ' + output);
|
||||
return { x: parseInt(match[1], 10), y: parseInt(match[2], 10) };
|
||||
}
|
||||
|
||||
@ -19,7 +19,6 @@ const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
||||
|
||||
async function main() {
|
||||
console.log('已启动防息屏,每 15 秒移动鼠标 1 像素再移回原位。Ctrl+C 停止。\n');
|
||||
let moving = false;
|
||||
|
||||
process.on('SIGINT', () => {
|
||||
console.log('\n已停止。');
|
||||
|
||||
Loading…
Reference in New Issue
Block a user