MCPcopy Index your code
hub / github.com/ZToolsCenter/ZTools / isAppRunning

Method isAppRunning

src/main/utils/appleScriptHelper.ts:252–266  ·  view source on GitHub ↗

* 检查指定应用是否正在运行 * @param appName 应用程序名称 * @returns 是否正在运行

(appName: string)

Source from the content-addressed store, hash-verified

250 * @returns 是否正在运行
251 */
252 async isAppRunning(appName: string): Promise<boolean> {
253 try {
254 const script = `
255 tell application "System Events"
256 set isRunning to (name of processes) contains "${appName}"
257 return isRunning
258 end tell
259 `
260 const result = await this.execute(script)
261 return result === 'true'
262 } catch (error) {
263 console.error(`[AppleScript] 检查应用 ${appName} 运行状态失败:`, error)
264 return false
265 }
266 }
267
268 /**
269 * 退出指定应用程序

Callers

nothing calls this directly

Calls 1

executeMethod · 0.95

Tested by

no test coverage detected