Gabriel M Couto Postado 15 de outubro de 2011 Denunciar Postado 15 de outubro de 2011 Eu adoro o Growl, adoro as notificações unificadas. Na minha opinião, o Growl deveria estar embutido no OS X há anos. O OS X vai evoluindo, e com o tempo seus programas também. O problema é que muitos programas nativos do sistema que poderiam fazer bom uso desse sistema de notificações. E para isso tu encontra programas na Web que estão dispostos a fazer isso. Na verdade, a própria equipe do Growl faz. Assim como o GrowlTunes funciona perfeito no iTunes, o GrowlMail funcionava no Mail. Só que o Mail se tornou muito complexo, dificultando a adição de suporte via um aplicativo extra. Portanto, a equipe parou de desenvolver. O projeto do GrowlMail foi tomado por um terceiro, e pelo visto tem sido atualizado por ele. O problema é que é complicado de achar a página de download, além de que a cada atualização do sistema, o programa para de funcionar. Como eu não queria passar trabalho, fui ver o suporte dos dois aplicativos via AppleScript, e percebi que eu poderia desenvolver, eu mesmo, um Script que fizesse praticamente a mesma coisa... lindamente. E fiz. Bom, a solução que criei pode não ser a mais elegante de todas... mas funciona perfeito pra mim. É bem fácil de instalar, pelo menos. Baixe o meu script "IncomingMail" em AppleScript, e salve ele em algum lugar que não vá ser deletado, nem atrapalhar seu fluxo de trabalho. Depois, abra o Mail, vá em Preferências, e clique na aba Regras: Vá em adicionar regra e ajuste como na ilustração abaixo: Eu preferi fazer com que o Script execute em todas as mensagens, já que ele automaticamente filtra apenas mensagens válidas que merecem notificação(apenas mensagens novas, que não estão na lixeira, nem são spam). Note que na seção de executar ações, é importante selecionar a opção de rodar um AppleScript e selecionar o arquivo que você baixou lá no início do post. As notificações ficarão parecidas com essa: Você pode modificar o Script você mesmo para mudar a notificação como quiser. Post original: http://couto.cc/post...-o-growl-ja-que Citar
Gabriel M Couto Postado 15 de outubro de 2011 Autor Denunciar Postado 15 de outubro de 2011 Código do Script, a quem interessar possa: -- IncomingMail v1.0, a replacement for GrowlMail-- by Gabriel Couto-- October 15, 2011---- tested on Mail 5.1 on Mac OS X 10.7.2-- truncates a string at max index-- retrieved from http://www.salling.com/forums/viewtopic.php?p=1461#1461on truncateString(txt, max)set txtLength to (length of txt)if txtLength > max then set txt to (text 1 thru (max - 1) of txt) as stringend ifreturn txtend truncateString-- find and replaces text in a string-- retrieved from http://foolsworkshop.com/applescript/2008/05/an-applescript-replace-text-method/on replaceText(find, replace, subject)set prevTIDs to text item delimiters of AppleScriptset text item delimiters of AppleScript to findset subject to text items of subjectset text item delimiters of AppleScript to replaceset subject to "" & subjectset text item delimiters of AppleScript to prevTIDsreturn subjectend replaceText-- Notify a message from Mail to Growl.-- theMessage = a message from Mail suite-- acceptAnyMessage = if it ignore message properties(read,junk,delete) and notify anyway-- by Gabriel Coutousing terms from application "Mail"on notifyMessage(theMessage, acceptAnyMessage) tell theMessage set msgRead to read status set msgDeleted to deleted status set msgJunk to junk mail status end tell if ((not msgRead) and (not msgDeleted) and (not msgJunk) or acceptAnyMessage) then tell theMessage set msgSender to sender set msgSubject to subject set msgSubject to msgSubject as string set msgSubject to (my (truncateString(msgSubject, 32))) & "..." set msgContent to content set msgContent to msgContent as string -- truncates to work with smaller text set msgContent to my (truncateString(msgContent, 300)) -- removes 'return' set msgContent to my (replaceText(return, " ", msgContent)) -- removes '\n' set msgContent to my (replaceText("", " ", msgContent)) -- removes '\r' set msgContent to my (replaceText("", " ", msgContent)) -- removes '\t' set msgContent to my (replaceText(" ", " ", msgContent)) -- removes multiple spaces set msgContent to my (replaceText(" ", " ", msgContent)) -- truncates for final size set msgContent to (my (truncateString(msgContent, 150))) & "..." end tell tell application "Growl" register as application "Mail" all notifications {"NewMessage"} default notifications {"NewMessage"} icon of application "Mail.app" notify with name "NewMessage" title msgSender description (msgSubject & return & return & msgContent) application name "Mail" end tell end ifend notifyMessageend using terms from-- this is on the purpose for test notification with selected messages on Mail, will work with any selected messages-- the code is the same of the one called by the Mail on the rulestell application "Mail"set temp to selectionset theMessage to first item of temp-- set theMessage to (item 1 of (messages of inbox whose id is equal to 11991))my notifyMessage(theMessage, true)end tell-- mail function called when your rule is activatedusing terms from application "Mail"on perform mail action with messages theSelectedMessages for rule theRule repeat with a from 1 to count theSelectedMessages set theMessage to (item a of theSelectedMessages) my notifyMessage(theMessage, false) end repeatend perform mail action with messagesend using terms from[/CODE] Citar
Gabriel M Couto Postado 16 de outubro de 2011 Autor Denunciar Postado 16 de outubro de 2011 Só para avisar, foi testado com o Growl 1.3... não sei se funciona com versões anteriores. Citar
javaXviper Postado 16 de outubro de 2011 Denunciar Postado 16 de outubro de 2011 Testei aki no Growl 1.2.2 no Lion e funcionou certinho!!! Acho que vou modificar o script para ele mostrar apenas o assunto e o remetente e posto aqui!! Brigadão Gabriel Citar
javaXviper Postado 16 de outubro de 2011 Denunciar Postado 16 de outubro de 2011 To postando o script que só mostra o assunto e o E-mail de quem está enviando. Nem mudei nome nem nada, pq qm fez foi o Gabriel e o q eu fiz foi tirar uma variavel só -- IncomingMail v1.0, a replacement for GrowlMail-- by Gabriel Couto-- October 15, 2011---- tested on Mail 5.1 on Mac OS X 10.7.2-- truncates a string at max index-- retrieved from http://www.salling.com/forums/viewtopic.php?p=1461#1461on truncateString(txt, max)set txtLength to (length of txt)if txtLength > max then set txt to (text 1 thru (max - 1) of txt) as stringend ifreturn txtend truncateString-- find and replaces text in a string-- retrieved from http://foolsworkshop.com/applescript/2008/05/an-applescript-replace-text-method/on replaceText(find, replace, subject)set prevTIDs to text item delimiters of AppleScriptset text item delimiters of AppleScript to findset subject to text items of subjectset text item delimiters of AppleScript to replaceset subject to "" & subjectset text item delimiters of AppleScript to prevTIDsreturn subjectend replaceText-- Notify a message from Mail to Growl.-- theMessage = a message from Mail suite-- acceptAnyMessage = if it ignore message properties(read,junk,delete) and notify anyway-- by Gabriel Coutousing terms from application "Mail"on notifyMessage(theMessage, acceptAnyMessage) tell theMessage set msgRead to read status set msgDeleted to deleted status set msgJunk to junk mail status end tell if ((not msgRead) and (not msgDeleted) and (not msgJunk) or acceptAnyMessage) then tell theMessage set msgSender to sender set msgSubject to subject set msgSubject to msgSubject as string set msgSubject to (my (truncateString(msgSubject, 32))) & "..." set msgContent to content set msgContent to msgContent as string -- truncates to work with smaller text set msgContent to my (truncateString(msgContent, 300)) -- removes 'return' set msgContent to my (replaceText(return, " ", msgContent)) -- removes '\n' set msgContent to my (replaceText("", " ", msgContent)) -- removes '\r' set msgContent to my (replaceText("", " ", msgContent)) -- removes '\t' set msgContent to my (replaceText(" ", " ", msgContent)) -- removes multiple spaces set msgContent to my (replaceText(" ", " ", msgContent)) -- truncates for final size set msgContent to (my (truncateString(msgContent, 150))) & "..." end tell tell application "GrowlHelperApp" register as application "Mail" all notifications {"NewMessage"} default notifications {"NewMessage"} icon of application "Mail.app" notify with name "NewMessage" title msgSender description (msgSubject & return & return) application name "Mail" end tell end ifend notifyMessageend using terms from-- this is on the purpose for test notification with selected messages on Mail, will work with any selected messages-- the code is the same of the one called by the Mail on the rulestell application "Mail"set temp to selectionset theMessage to first item of temp-- set theMessage to (item 1 of (messages of inbox whose id is equal to 11991))my notifyMessage(theMessage, true)end tell-- mail function called when your rule is activatedusing terms from application "Mail"on perform mail action with messages theSelectedMessages for rule theRule repeat with a from 1 to count theSelectedMessages set theMessage to (item a of theSelectedMessages) my notifyMessage(theMessage, false) end repeatend perform mail action with messagesend using terms from[/CODE]abrasssssssss Citar
Gabriel M Couto Postado 20 de março de 2012 Autor Denunciar Postado 20 de março de 2012 Atualizado versão 1.1 Se você não sabe o que é o IncomingMail, ou quer saber como instalar, ver o post original: http://tmblr.co/ZPZqmwAhjMU7 O que mudou desde a última versão: Melhoramento na remoção de caracteres “brancos” na notificação, impedindo que ocorram notificações enormes. Ao truncar uma string, é colocado reticências no final da string… para dar um senso de continuidade. Download da versão 1.1: http://api.cld.me/1X1J170f0a200o3t1Y2s/download/IncomingMail.scpt Citar
Posts Recomendados
Participe do debate
Você pode postar agora e se registrar depois. Se você tem uma conta, entre agora para postar com ela.