Set text of a Growl Notification using Automator?

孤人 提交于 2019-12-11 08:31:34

问题


I have an Automator Application containing the action "Show Growl Notification", which is always empty when it appears. I've tried using the "Get Specified Text" and "Get Value Of Variable" actions directly before it, but nothing I've tried seems to work.


回答1:


The code sample from gadgetmo is almost correct but won't work as is with Growl 1.4

An application must be registered and enabled and must provide a list of notifications it will present and also a list of which of those notifications are enabled.

You can skip all that config stuff if you just hijack the preconfigured automator settings as shown below.

Key points to note are "Automator notification" as the name of the notification and "Automator" as the source application.

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

if isRunning then
    tell application id "com.Growl.GrowlHelperApp"
        notify with name ¬
            "Automator notification" title ¬
            "Processing Files" description ¬
            input as text application name "Automator"
    end tell
end if



回答2:


Use this in a Run Applescript:

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

if isRunning then
tell application id "com.Growl.GrowlHelperApp"
notify with name ¬
"Test Notification" title ¬
"Test Notification" description ¬
"This is a test AppleScript notification." application name "Growl AppleScript Sample"
end tell
end if

Or download it here.

You can also use this with input.




回答3:


The action just passes the input through, and doesn't have any text fields that accept variables, so you will need to manually put in the message you want. The Show Growl Notification action (located inside the GrowlHelperApp bundle) does use an AppleScript, so you could modify a copy to do something like use the input if the message field is blank.



来源:https://stackoverflow.com/questions/8209312/set-text-of-a-growl-notification-using-automator

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