I am writing a script to check my email and need some help with it. Basically I have a .mac account that I use in conjunction with mail.app. I do not use the dock, so I have no icon with the number of new messages and I don't want to use anything bloated like konfabulator. The perfect solution is just for a small dialog to pop up telling me I have new mail. This is what I have so far:
display dialog "You've got mail." buttons {"Read", "Ignore"}
if button returned of result = "Read" then
tell application "Mail"
activate
set theViewer to make new message viewer
end tell
end if
Then I have a rule set in mail for every message to run this script. Here are the issues I am having...
1. If there is already an instance of mail open, it opens a new blank viewer. If not then it works as plan and simply opens my inbox.
2. if I have mail hidden, the script with be hidden also when it runs, presumably because the rule comes from mail which is hidden.
So here is what I want for it.
New Mail arrives, runs applescript and pops up dialog that states "You've got Mail." "2 new messages" It would then present two options, ignore or read. If you click ignore it would simply go away, if you click read it would open up the inbox. If the app is hidden, it would unhide it and if the window was closed it would start a new instance opening the inbox instead of just moving the menu bar to the front.
So, I don't know if I am on the right track or not. Also, if someone knows how to do this, it should be fairly simple for an experienced programmer, I would be willing to pay say 10 dollars or so for it.
Thank you everyone.