0

I have read these four questions with examples for how to use the background activity count Applescript property in Mail.app:

Check for New Mail of specific Mailbox/Folder Applescript

AppleScript and Mail.app: checking if new messages contain a string

AppleScript can't read Mail.app's messages

Applescript to wait for AppleMail to download messages.

It seems simple enough but when I do I get an error:

error "Mail got an error: AppleEvent handler failed." number -10000

Some code:

tell application "Mail"
    activate
    set bg_count to background activity count
    
    repeat until background activity count = 0
        delay 0.1 --wait until all new messages are in the box
    end repeat
end tell

Both the set- and the repeat-statement give the same error message.

What is going on here? Is this broken?

d-b
  • 695
  • 3
  • 14
  • 43

0 Answers0