Please help me, if you don't mind

Oct 11, 2005 18:34

I seem to have my only but very nasty problem with AppleScript:
Inability to make a command wait for the output of the previous command.
For example now I'm checking for new mail and after Mail have completed the operation, I want to either activate Mail or say "No messages" and quit. But in

tell application "Mail"
check for new mail
set newMessagesCount to unread count of inbox
if newMessagesCount > 0 then
say "There are " & newMessagesCount & " new messages."
activate
else
say "There are no new messages."
quit
end if
end tell

set statement won't wait for check for new mail and the whole thing becomes useless.
Is there any common solution to all such problems or at least a key to this concrete problem?
Previous post Next post
Up