AppleScript の表示ダイアログを Growl または growlnotify に渡すにはどうすればいいですか?

AppleScript の表示ダイアログを Growl または growlnotify に渡すにはどうすればいいですか?

クリップボード内のテキストを取得し、使用されている単語と文字の数を出力する簡単な AppleScript があります。

私がやろうとしているのは、「ダイアログの表示」を Growl または growlnotify に渡すことです。シェルで growlnotify を使用する方法は知っています。これは優れた機能で、高度にカスタマイズ可能です (メモを貼り付ける、アプリのアイコンや画像を割り当てるなど)。しかし、問題は、AppleScript でそれを実行する方法がわからないことです。少し Google で検索しましたが、時間が経ってしまったので、ここで質問を投稿することにしました。

それで、スクリプトは次のとおりです:

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

そこにはドキュメンテーションそのために、私は例を挙げるこの回答では

以下は OS X Lion 上の Growl 1.3.3 で動作します:

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

関連情報