Re: saving mails...
Re: saving mails...
- Subject: Re: saving mails...
- From: Christopher Stone <email@hidden>
- Date: Sun, 04 Feb 2018 18:15:29 -0600
On 02/03/2018, at 06:41, Jean-Christophe Helary
<email@hidden <mailto:email@hidden>>
wrote:
> Trying to go back to my mail saving thing where I save as raw message but
> then can't reply to the mail when I open it...
> ...
> and I can't make sense of what is *not* happening... myMail is supposed to be
> a reference and save needs a reference. So what's wrong?
Hey Jean-Christophe,
To the best of my recollection this has never worked.
It is beyond ridiculous to be unable to go straight from a message to it's file
on-disk, but then Mail's sdef has several defects and omissions and needs some
TLC.
Eudora could do this and work with selected text in 1996! But then Steve
Dorner would actually listen to his users...
Your best bet is probably to work copy the disk-file associated with the
message.
Finding it with Spotlight is slow in computer terms but reasonably acceptable
in human terms.
----------------------------------------------------------------
# Auth: Christopher Stone <email@hidden
<mailto:email@hidden>>
# dCre: 2012/07/18 05:51
# dMod: 2018/02/04 17:56
# Appl: Mail
# Task: Find the disk file of the selected email message using Spotlight.
# Libs: Uses only OSX components.
# Test: Lion & Mountain Lion, Mavericks, Yosemite, Sierra
# Tags: @Applescript, @Mail, @Find, @Disk, @File, @Selected, @Email, @Message,
@Spotlight
----------------------------------------------------------------
set AppleScript's text item delimiters to {""}
tell application "Mail"
set _sel to selection
if length of _sel = 1 then
set _msg to item 1 of _sel
else
error "Too many messages selected."
end if
# Use account to find mail-folder in attempt to be compatible back to
Snow Leopard.
set acnt1Dir to (account directory of account 1) as string
set {oldTIDS, AppleScript's text item delimiters} to {AppleScript's
text item delimiters, ":"}
set mailFolderPath to POSIX path of (text items 1 thru -3 of acnt1Dir
as string)
set AppleScript's text item delimiters to oldTIDS
tell _msg
set mbxName to name of its mailbox
set mID to its id
set mSub to its subject
end tell
end tell
# Escape single quotes in subject for spotlight query string.
if mSub contains "'" then
set mSub to REPL(mSub, "'", "'\"'\"'")
end if
# Find email
set shCMD to "mdfind -onlyin " & mailFolderPath & " 'kMDItemDisplayName == \""
& mSub & "\"cd && kMDItemFSName == \"" & mID & ".emlx\"cd'"
set emlFile to do shell script shCMD
----------------------------------------------------------------
--
Take Care,
Chris
_______________________________________________
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