Как передать диалоговое окно отображения AppleScripts в Growl или growlnotify?

Как передать диалоговое окно отображения AppleScripts в Growl или growlnotify?

У меня есть простой AppleScript, который берет текст из буфера обмена и выводит количество использованных слов и символов.

Я пытаюсь передать "display dialog" в Growl или growlnotify. Я знаю, как использовать growlnotify в оболочке - это здорово и очень настраиваемо (прикрепить заметку, назначить значок приложения или изображение и т. д.) - но суть в том, что я не знаю, как это сделать в AppleScript. Я немного погуглил, но теперь прошло время, и я решил разместить свой вопрос здесь.

Итак, вот сценарий:

set myCount to count (the clipboard)
set myWords to count words of (the clipboard)
set myParas to count paragraphs of (the clipboard)

display dialog "Characters: " & myCount & "
Words: " & myWords & "
Paragraphs: " & myParas

Спасибо.

решение1

Естьдокументациядля этого я привожу примерв этом ответе.

Следующее работает с Growl 1.3.3 на OS X Lion:

tell application "Growl"
    set the allNotificationsList to {"Word Count"}
    set the enabledNotificationsList to {"Word Count"}

    register as application "Word Counter" all notifications allNotificationsList default notifications enabledNotificationsList icon of application "Script Editor"

    set myCount to count (the clipboard)
    set myWords to count words of (the clipboard)
    set myParas to count paragraphs of (the clipboard)
    --       Send a Notification...
    notify with name "Word Count" title "Word Counter" description (myCount as text) & " " & (myWords as text) & " " & (myParas as text) application name "Word Counter"
end tell

Скриншот уведомления

Скриншот настроек приложения

решение2

set input to the clipboard as text
set output to (number of characters of input & " characters
" & number of words of input & " words
" & number of paragraphs of input & " paragraphs") as text
do shell script "/usr/local/bin/growlnotify " & quoted form of output
-- brew install growlnotify

Связанный контент