如何确定 Growl 是否正在使用 AppleScript 运行? [英] How do I determine whether Growl is running using AppleScript?

查看:21
本文介绍了如何确定 Growl 是否正在使用 AppleScript 运行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我过去为了判断 Growl helper 是否在 macOS 上运行,我用过

I the past, in order to determine whether the Growl helper is running on macOS, I've used

tell application "System Events"
    set isRunning to (count of (every process whose bundle identifier is "com.Growl.GrowlHelperApp")) > 0
end tell

但最近,有人提出了这个和替代方案

But recently, both this and an alternative thats been suggested

tell application "System Events" to set isRunning to exists (processes where name is "com.Growl.GrowlHelperApp")

永远运行.这似乎(仅)发生在它(或更准确地说,应用程序Hardware Growler"未运行)时,但显然仍然不是预期的结果.

just run forever. This seems to happen (only) when it (or more precisely the app "Hardware Growler" is not running), but is still clearly not the desired outcome.

如何确定 Growl 是否正在使用 AppleScript 运行?

How do I determine whether Growl is running using AppleScript?

推荐答案

虽然我无法识别暗示 GrowlHelper 在后台运行的进程名称(Growl 2.13,Mac App Store 版本),但我找到了替代解决方案.

While I was not able to identify a process name that hints at GrowlHelper running in the background (Growl 2.13, Mac App Store version), I found an alternative solution.

事实上,Growl 2.13 甚至可能不需要使用 GrowlHelperApp 本身来在用户登录时启动.

In fact Growl 2.13 may not even need to use GrowlHelperApp itself to launch on user login.

在终端类型中

defaults read ~/Library/Containers/com.Growl.GrowlHelperApp/Data/Library/Preferences/com.Growl.GrowlHelperApp.plist ShouldStartGrowlAtLogin

这将输出 1(真)或 0(假)的值.每次在 Growl 的首选项中切换开关时都会修改此文件.

This will output a value of 1 (true) or 0 (false). This file is modified every time you toggle the switch in Growl's preferences.

这篇关于如何确定 Growl 是否正在使用 AppleScript 运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆