The following script works fine when it is all by itself
tell application “Mail”
set theBox to mailbox “System Alerts”
repeat with ThisMessage in (every message of theBox)
set is deleted of ThisMessage to true
but when I include it as part of a much larger script it only deletes half the mail every time.
Are any of these variables used anywhere else in the script? It’s hard to know what’s going on without knowing more about the script. Maybe there’s a way you can elliminate parts of the code until you find whatever’s causing the problem?
The rest of the code executes properly. This is the only part of the code that does not do its whole job. It is the very last operation of the script. Nope, the variables are unique to this part of the script.