Move Mail message via AppleScript unacceptably slow

Originator:dbyler
Number:rdar://9909730 Date Originated:06-Aug-2011 11:26 AM
Status:Open Resolved:
Product:Mail Product Version:Version 5.0 (1244.2/1244.3)
Classification:Performance Reproducible:Always
 
06-Aug-2011 11:26 AM Dan Byler:
'archive mail message.scpt' was successfully uploaded

06-Aug-2011 11:26 AM Dan Byler:
Summary: Using AppleScript to move a Mail message to another folder takes a long time.

Steps to Reproduce:

1. Make sure an email account has a folder called "Archive"
2. Select an email from that account
3. Run this AppleScript (also attached):

tell application "Mail"
	repeat with thisMessageViewer in message viewers
		if window of thisMessageViewer is first window then
			set theSelectedMessages to selection
			if theSelectedMessages is {} then return
			repeat with theMessage in theSelectedMessages
				set theAccount to name of account of mailbox of theMessage
				move theMessage to mailbox "Archive" of account theAccount
			end repeat
			return
		end if
	end repeat
end tell


Expected Results:

- Message is moved to the Archive folder quickly

Actual Results:

- Message is moved to the Archive folder, but can take anywhere from 1-20 seconds to complete

Regression:

- Yes. In Snow Leopard, this was a sub-second operation

Notes:

- See the following discussions for others with the same problem:

http://superuser.com/questions/319445/os-x-lion-applescript-greatly-slowed-down
http://macscripter.net/viewtopic.php?pid=142869

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!