Como passar a caixa de diálogo do AppleScripts para Growl ou growlnotify?

0

Eu tenho este AppleScript simples que pega o texto na área de transferência e gera a quantidade de palavras e caracteres usados.

O que estou tentando fazer é passar "exibir diálogo" para Growl ou growlnotify. Eu sei como usar growlnotify no shell - é ótimo e altamente personalizável (nota de pau, atribuir ícone do aplicativo ou uma imagem, etc) - mas o ponto é: eu não sei como fazê-lo no AppleScript. Eu google um pouco, mas agora o tempo passou e eu decidi postar a minha pergunta aqui.

Então, aqui está o script:

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

Obrigado.

    
por pattulus 30.05.2012 / 19:07

2 respostas

1

Existe documentação para isso, eu forneço um exemplo nesta resposta .

O seguinte funciona com o Growl 1.3.3 no 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

    
por 30.05.2012 / 19:13
1
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
    
por 31.05.2012 / 11:56