使用自动化设置咆哮通知的文本



我有一个自动应用程序包含的行动"显示咆哮通知",这总是空的,当它出现。我已经尝试使用"获取指定文本"one_answers"获取变量值"的行动直接在它之前,但没有我试过似乎工作。

来自gadgetmo的代码示例几乎是正确的,但不能像Growl 1.4那样工作

应用程序必须注册并启用,并且必须提供它将显示的通知列表以及这些通知中已启用的通知列表。

你可以跳过所有的配置,如果你只是劫持预配置的自动设置,如下所示。

需要注意的重点是"Automator notification"作为通知的名称,"Automator"作为源应用程序。

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

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

或者在这里下载

该操作只是传递输入,并且没有任何接受变量的文本字段,因此您需要手动输入所需的消息。Show Growl Notification操作(位于GrowlHelperApp包内)确实使用了AppleScript,所以你可以修改副本来做一些事情,比如在消息字段为空时使用输入。

最新更新