Using a script from this site to forward as attachment (submitted by jalessi (thanks!)), I added two lines, to set read status to true and delete the messages. When I run the script as a script, it works fine, but if I run the compiled app, it fails with the message that it cannot set the read status to true. Any ideas why?
set sourceFile to "Tiger:forward.eml"
tell application "Mail"
set theMessages to the selection
repeat with thisMessage in theMessages
set thisSource to the source of thisMessage as string
set f to open for access sourceFile with write permission
set eof of f to 0
write thisSource to f
close access f
set newMessage to make new outgoing message at end of outgoing messages
tell newMessage
set subject to thisMessage's subject
make new to recipient with properties {name:"uce", address:"spam@uce.gov"}
tell content to make new attachment with properties {file name:sourceFile as alias} at after the last paragraph
end tell
set visible of newMessage to true
send newMessage
end repeat
set read status of theMessages to true
delete theMessages
end tell
do shell script "rm '/forward.eml'"
Any help is greatly appreciated,
Cheers,
Allan