- Joined
- Apr 27, 2008
- Messages
- 92
- Reaction score
- 5
- Points
- 8
- Your Mac's Specs
- MBP 2.5 Intel Core 2 Duo, 2GB 667 MHz DDR2, 17" Hi-Res Display ; iPhone 3G 2.1
I am running a script in geektool to display my current number of unread mail messages on my desktop. I found this script on a website somewhere:
echo 'tell application "Mail" to return unread count of mailboxes of accounts' | osascript | perl -e "@a=split ',',<STDIN>; foreach (@a) {\$n += \$_}; print \"\$n\n\";"
The problem is that every time it updates it forces mail to open, which is causing problems when shutting down, and also sometimes i just dont want mail to be open.
Is there a way to modify this script so that it checks to see if mail is already open, and if it isnt end the script?
echo 'tell application "Mail" to return unread count of mailboxes of accounts' | osascript | perl -e "@a=split ',',<STDIN>; foreach (@a) {\$n += \$_}; print \"\$n\n\";"
The problem is that every time it updates it forces mail to open, which is causing problems when shutting down, and also sometimes i just dont want mail to be open.
Is there a way to modify this script so that it checks to see if mail is already open, and if it isnt end the script?