Re: saving mails...
Re: saving mails...
- Subject: Re: saving mails...
- From: Jean-Christophe Helary via AppleScript-Users <email@hidden>
- Date: Mon, 18 May 2020 17:04:38 +0900
I was testing Chris' script but it seems that although the script seems to work
(as far as I can tell in SD) the issue comes from mdfind, that does not produce
the expected result...
Chris' REPL was not included but seems to be equivalent to this:
on REPL(_string, _find, _replace)
set oldTIDS to AppleScript's text item delimiters
set AppleScript's text item delimiters to _find
set _string to text items of _string
set AppleScript's text item delimiters to _replace
set _string to _string as text
end REPL
Any idea why mdfind would not work ?
Jean-Christophe
> On Feb 5, 2018, at 9:15, Christopher Stone <email@hidden>
> wrote:
>
> On 02/03/2018, at 06:41, Jean-Christophe Helary
> <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>
> # 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
Jean-Christophe Helary
-----------------------------------------------
http://mac4translators.blogspot.com @brandelune
_______________________________________________
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