How do I determine whether Growl is running using AppleScript?

跟風遠走 提交于 2019-12-23 02:58:32

问题


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")

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.

How do I determine whether Growl is running using AppleScript?


回答1:


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.

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


Check whether Growl is set to launch on login

In Terminal type

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

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.



来源:https://stackoverflow.com/questions/43588494/how-do-i-determine-whether-growl-is-running-using-applescript

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!