使用 Automator 设置咆哮通知的文本?

发布于 2024-12-17 02:44:57 字数 91 浏览 0 评论 0原文

我有一个包含“显示咆哮通知”操作的自动化应用程序,该操作出现时始终为空。我尝试直接在其之前使用“获取指定文本”和“获取变量值”操作,但我尝试过的任何操作似乎都不起作用。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

最冷一天 2024-12-24 02:44:57

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

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
小瓶盖 2024-12-24 02:44:57

运行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

或者在此处下载

您也可以将其与输入一起使用。

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.

习ぎ惯性依靠 2024-12-24 02:44:57

该操作仅传递输入,并且没有任何接受变量的文本字段,因此您需要手动输入所需的消息。 显示咆哮通知操作(位于GrowlHelperApp包内)确实使用AppleScript,因此您可以修改副本以执行诸如在消息字段为空时使用输入之类的操作。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文