AppleScripts 표시 대화 상자를 Growl 또는 Growlnotify에 전달하는 방법은 무엇입니까?

AppleScripts 표시 대화 상자를 Growl 또는 Growlnotify에 전달하는 방법은 무엇입니까?

클립보드의 텍스트를 가져와 사용된 단어와 문자의 양을 출력하는 간단한 AppleScript가 있습니다.

내가 하려는 것은 "표시 대화 상자"를 Growl 또는 Growlnotify로 전달하는 것입니다. 나는 쉘에서 grindlnotify를 사용하는 방법을 알고 있습니다. 훌륭하고 사용자 정의가 가능합니다(스틱 노트, 앱 아이콘 또는 이미지 할당 등). 그러나 요점은 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

관련 정보