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

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

问题描述

过去,为了确定Growl助手是否正在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天全站免登陆