* 隐藏指定应用程序 * @param appName 应用程序名称 * @returns 是否成功隐藏
(appName: string)
| 291 | * @returns 是否成功隐藏 |
| 292 | */ |
| 293 | async hideApp(appName: string): Promise<boolean> { |
| 294 | try { |
| 295 | const script = ` |
| 296 | tell application "System Events" |
| 297 | set visible of process "${appName}" to false |
| 298 | end tell |
| 299 | ` |
| 300 | await this.execute(script) |
| 301 | return true |
| 302 | } catch (error) { |
| 303 | console.error(`[AppleScript] 隐藏应用 ${appName} 失败:`, error) |
| 304 | return false |
| 305 | } |
| 306 | } |
| 307 | |
| 308 | /** |
| 309 | * 执行粘贴操作(模拟 Command+V) |