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: PsiPhi on Apr 21, '04 05:43:38PM
I'm the person who wrote The Unread.

The problem you note is known to me but I haven't yet found a way around it. The thing is, The Unread uses AppleScript to communicate with Mail and there is one very important little AppleScript call that I use to test whether Mail is running before asking it (Mail) for info. Basically it goes:

tell application "Finder"
    if (get name of every process) contains "Mail" then
        tell application "Mail"
            -- do stuff
        end tell
        --Mail isn't running, don't do anything
    end if
end tell

The "tell application "Finder"" bit is what launches Finder if it is not running but I haven't found a way to test whether Mail is running (and not launching it if it isn't) without using this statement. If I omit it, it works fine but Mail is launched when whenever The Unread checks for unread messages. I weighed the pros and cons of both situations and decided that, for now, it's better the way it is. I don't know, though, maybe Path Finder has a similar AppleScript call that I could use if the user indicated they use it rather than Finder... Still, I'd get email from people saying that The Unread launches Mail unwantedly (is that a word?) though they don't use Path Finder - they just quit the Finder for some reason or another...

Comments and/or suggestions are more than welcome (peterATschartworksDOTcom).

[ Reply to This | # ]
The Unread needs the Finder running
Authored by: subatomicsatan on Apr 21, '04 06:09:48PM

i'm not sure what "the unread" is written in, but can you make a unix system call to, for example, 'ps ax' and grep that for "Mail"? it would be trivial to do in perl, but i'm not sure how you've implemented "the unread."

btw, i just installed it and am liking it so far! :)


[ Reply to This | # ]
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 '' | 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.


[ Reply to This | # ]
The Unread needs the Finder running
Authored by: PsiPhi on Apr 21, '04 06:52:38PM

Well, it uses a combination of AppleScript and Cocoa so I could use that fairly easily inside the AppleScript but I just got an email from somebody that told me the "(get name of every process)" call is passed on to System Events by the Finder so I can just bypass Finder and ask System Events. That should work fine. Thanks for the suggestion, though.

I actually have a new version that is almost ready to be released and I will put this fix in the AppleScripts so that should alleviate the grandparent's complaint.

[ Reply to This | # ]
The Unread needs the Finder running
Authored by: Sarek on Apr 21, '04 11:21:07PM

Sorry if this is offtopic. I love your suggestions and troubleshooting on this issue. I'ved learned about a great app, the author gets involved in the discussion and others are flocking with resolutions -- this is what it means to be a mac user in today's age. 10 years ago I think it was more user-interface driven and how you can "trick-out" your UI... now it's about the developer and users coming together to solve problems.

Again, sorry for being off topic. I love "The Unread" and never knew it existed. I love the fact everyone is coming together. I love the fact the author seems so open. This just blows me away guys -- thanks!!


[ Reply to This | # ]