It seems that some application's AppleScript's implementation is lazy.
This slightly modified code works for me:
repeat with myMessage in messages of mailbox "myMailbox"
set myYear to year of ( get date received of myMessage)
log myYear
end repeat
Yvan,
*I* may say I have been lazy - because I read the "get" does return a
result "result", even if sometimes it is not needed.
Anyway, good lesson.
I don't want to go to far but then
if myYear = 2004 then
move myMessage to mailbox "essai"
end if
says :
get date received of item 12 of every message of mailbox "myMailbox"
date "vendredi 29 octobre 2004 12:00:30"
move item 12 of every message of mailbox "myMailbox" to mailbox "essai"
"Mail got an error: NSInternalScriptError"
I had tried a move <message> to <mailbox> before with no problem -
but where is it ?