* 执行粘贴操作(模拟 Command+V) * @returns 是否成功执行粘贴
()
| 310 | * @returns 是否成功执行粘贴 |
| 311 | */ |
| 312 | async paste(): Promise<boolean> { |
| 313 | try { |
| 314 | const script = ` |
| 315 | tell application "System Events" |
| 316 | keystroke "v" using command down |
| 317 | end tell |
| 318 | ` |
| 319 | await this.execute(script) |
| 320 | console.log('[AppleScript] 已执行粘贴操作 (Command+V)') |
| 321 | return true |
| 322 | } catch (error) { |
| 323 | console.error('[AppleScript] 执行粘贴操作失败:', error) |
| 324 | return false |
| 325 | } |
| 326 | } |
| 327 | } |
| 328 | |
| 329 | // 导出单例 |