Re: Mail Scripting - Copy Messages to Finder Folder
Re: Mail Scripting - Copy Messages to Finder Folder
- Subject: Re: Mail Scripting - Copy Messages to Finder Folder
- From: Axel Luttgens <email@hidden>
- Date: Fri, 28 Jun 2013 09:12:42 +0200
Le 27 juin 2013 à 04:19, Bruce Robertson a écrit :
> [...]
>
> The purpose is to copy selected messages to a user designated Finder folder.
> So if you have suggestion for other methods to accomplish this result, of course they are welcome.
>
> [...]
Hello Bruce,
One first suggestion, that should avoid to depend on the way Mail stores its messages (unless I'm wrong, this has already changed at least three times in the history of that software).
The script copies the messages as they are stored by Mail. Strictly speaking, they should thus be saved with an ".emlx" extension, not with an ".eml" one, since they contain the original message and some metadata for indexing needs.
So, the very first question is to know the purpose of copying messages as saved by Mail somewhere else. It is very likely that ".eml" files would be sufficient, in which case your problem is solved.
Assuming a helper handler similar to this one:
on WriteFile(fldrAlias, fileName, txt)
local fRef
set fRef to open for access file ((fldrAlias as text) & fileName) with write permission
write txt to fRef
close access fRef
end WriteFile
you may remove the "POSIX path of" part of the "set theFolder to..." statement:
set theFolder to (choose folder with prompt "Save Exported Messages to..." without invisibles)
and replace the second half of the loop body by:
my WriteFile(theFolder, msgDate & "_" & msgSubject & ".eml", source of msg)
HTH,
Axel
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden