Brilliant, works every time!
Actually, you were the one who found the solution by trying the following statement:
set CS_Messages to every message that subject contains "Daily Summary"
Have you any idea why my original script stopped working, just like to know to stop this happening again.
Since the original script has always worked flawlessly on my computer under OS X 10.8.1, the only thing I can think of would be another application interfering with Mail or AppleScript in your system.
By the way, the following version of the script might be somewhat faster when you have a huge number of messages in your mailbox:
set theContents to {}
set theContentsRef to a reference to theContents
tell application "Mail"
tell mailbox "CS Notepad"
tell mailbox "Test"
set CS_Messages to every message that subject contains "Daily Summary"
repeat with thisMessage in CS_Messages
copy content of thisMessage to the end of theContentsRef
end repeat
end tell
end tell
end tell
theContents
See the AppleScript Language Guide, Class Reference, list (p. 110 in the PDF version) : “For large lists, it is more efficient to use the a reference to operator when inserting a large number of items into a list, rather than to access the list directly.”
Message was edited by: Pierre L.