Moving or deleting mails in Mail with AppleScript is dog slow. One of my scripts is:
[code]tell application “Mail”
set SelectedMails to selection
repeat with currentMail in SelectedMails
set isRead to get read status of currentMail
if isRead then
move currentMail to mailbox "Realbasic" of mailbox "Importiert"
The speed per mail is longer than a second. Deleting mails is similar in lack of speed. Does anyone have an idea how to speed this up?
The script above is executed directly. The rest of my scripts use the MBS plugin. Yosemite, Xojo 2014r2.
AppleScript is a bit hit and miss.
Can you try debugging it by removing bits of it - i.e. comment out the entire repeat loop, so it’s just the Setting bit that’s running, and seeing if that’s slow? Or, if that’s not, comment out the if isRead part.
have been playing around with the script for quite a bit already. Without the loop the script executes in less than a second for about 20 mails.
OK, so which bit of the stuff inside the loop is slow? The setting isRead, or the move?
It’s the move. Same for deleting mails.
Various things on the internet seem to say simply that ‘moving messages on Mavericks is dog-slow’. It used to be faster.
Beatrix, it might work to use the ‘ignoring applications responses’ clause, generating a command queue for Mail and forget about it. But you wouldn’t have error checking then.
And, in my experience, Mail on Yosemite is even S-L-O-W-E-R. What OS are you testing with, Beatrix?
The slowdown already was on Mavericks and even Mountain Lion. I wrote a Radar thing but this is sooo much worse than Feedback. My Radar has the number 19.244.199, which was closed as duplicate from 4.572.356. So it seems like an old and known issue.
My application can talk to Imap directly. I’ll try to combine handling a mail client with direct Imap in the near future.