Re: saving mails...
Re: saving mails...
- Subject: Re: saving mails...
- From: Jean-Christophe Helary via AppleScript-Users <email@hidden>
- Date: Mon, 18 May 2020 18:37:25 +0900
Thank you Yvan for testing.
the result of shCMD on your mail is:
mdfind -onlyin /Users/********/Library/Mail/V7 'kMDItemDisplayName == "Re:
saving mails..."cd && kMDItemFSName == "672421.emlx"cd'
And the result of mdfind is nothing...
But, a different script that Chris wrote to save the mail URI as an inetloc
file works fine, so your mail is, as expected, properly recognized on my
system...
Jean-Christophe
> On May 18, 2020, at 18:26, Yvan KOENIG via AppleScript-Users
> <email@hidden> wrote:
>
> Hello, I'm puzzled.
>
> I tested the complete script (with the REPL handler) and it returned
> correctly:
> "/Users/**********/Library/Mail/V5/30ACBF46-881C-40AC-B33B-500D53832270/forum
> AppleScript
> US.mbox/387AD57C-A952-46C3-83DA-4FFBC58D9679/Data/2/7/Messages/72668.emlx"
>
> What are you getting on your side?
>
> Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) lundi
> 18 mai 2020 11:25:19
>
>> Le 18 mai 2020 à 10:04, Jean-Christophe Helary via AppleScript-Users
>> <email@hidden> a écrit :
>>
>> 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