合规国际互联网加速 OSASE为企业客户提供高速稳定SD-WAN国际加速解决方案。 广告
[TOC] ## 概述 ## Mouse 引入 ``` const { Keyboard, Mouse } = require('leanpro.common'); ``` 函数 ``` export class Mouse { static move(x: number, y: number): void; static moveSmooth(x: number, y: number, seconds?: number): void; static drag(x: number, y: number, seconds?: number): void; static setDelay(delay: number): void; static position(): Point; static click(button: MouseKey): void; static doubleClick(button: MouseKey): void; static keyDown(button: MouseKey): void; static keyUp(button: MouseKey): void; static wheel(vertical: number, horizontal: number): void; } ``` ### 拖拽示例 ``` mouse.move(0, 0); mouse.keyDown(MouseKey.LButton); mouse.drag(100, 100); mouse.keyUp(1); ``` ## Keyboard ``` export class Keyboard { static Keys: Keys, static keyTap(key: string): void; static unicodeTap(keyCode: number): void; static keyDown(key: string): void; static keyUp(key: string): void; static setDelay(milliseconds: number): void; // static typeString(str: string, cpm?: number): void; // deprecated static pressKeys(keys: string, options?: PressKeysOptions | number): Promise<void>; static disableIme(); } ``` ## Screen ``` export class Screen { static screenRect(moniter?: number): Rect static all(moniter?: number): Rect[] static colorAt(x: number, y: number): string; static capture(rect?: Rect): Buffer; static captureToFile(filePath: string, rect?: Rect): void; static takeScreenshot(filePath: string, monitor?: number): string | void; // deprecated 弃用 static screenSize(): {width: number, height: number}; } ```