Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'The Unread needs the Finder running' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
The Unread needs the Finder running
Authored by: robg on Apr 21, '04 06:52:09PM
I'm not sure how to handle the error trapping, but it's pretty trivial to use the shell via AppleScript; this one liner will return the info on Mail if it's running. If it's not running, it throws a Type 1 error:

do shell script "ps ax | grep 'Mail.app/Contents' | grep -v grep | grep -v sh"
I'm sure there are more elegant ways of handling this; the two "grep -v" commands are used to eliminate the actual grep command, as well as the shell process that AppleScript launches. I know very little about AppleScript, but it should be trivial to trap on the error (Mail not running) or the successful return (Mail is running), all without launching the Finder.

-rob.

[ Reply to This | # ]