• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: saving mails...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: saving mails...


  • Subject: Re: saving mails...
  • From: Yvan KOENIG via AppleScript-Users <email@hidden>
  • Date: Fri, 22 May 2020 11:33:34 +0200

A message from Shane Stanley in
<https://macscripter.net/viewtopic.php?id=47686> remind me the power of its
library Metadata Lib.

Using it the wanted search would be achieved with :

[applescript]use AppleScript version "2.5" -- macOS 10.11 or later
use script "Metadata Lib" version "2.0.2"
use scripting additions

-- Yvan KOENIG (VALLAURIS, France) vendredi 22 mai 2020 10:55:15

my Germaine()

on Germaine()
        tell application "Mail"
                set _sel to selection
                # 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 AppleScript's text item delimiters to {":"}
                set mailFolderPath to POSIX path of (text items 1 thru -3 of
acnt1Dir as string)
                set AppleScript's text item delimiters to {""}
        end tell -- Mail

        set theMessages to {}
        repeat with _msg in _sel
                set end of theMessages to my getMessage(_msg, mailFolderPath)
        end repeat
        return theMessages

end Germaine

on getMessage(_msg, mailFolderPath)
        tell application "Mail" to tell _msg
                set mID to its id
        end tell
        set begName to (mID as string) & "."
        set boxpath to perform search in folders {mailFolderPath} predicate
string "kMDItemFSName BEGINSWITH %@" search arguments {begName}
        return boxpath
end getMessage

#=====[/applescript]

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) vendredi
22 mai 2020 11:31:32



 _______________________________________________
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

References: 
 >Re: saving mails... (From: Jean-Christophe Helary via AppleScript-Users <email@hidden>)
 >Re: saving mails... (From: Yvan KOENIG via AppleScript-Users <email@hidden>)
 >Re: saving mails... (From: Jean-Christophe Helary via AppleScript-Users <email@hidden>)
 >Re: saving mails... (From: Axel Lüttgens via AppleScript-Users <email@hidden>)
 >Re: saving mails... (From: Jean-Christophe Helary via AppleScript-Users <email@hidden>)
 >Re: saving mails... (From: Bob Stern via AppleScript-Users <email@hidden>)
 >Re: saving mails... (From: Yvan KOENIG via AppleScript-Users <email@hidden>)
 >Re: saving mails... (From: Jean-Christophe Helary via AppleScript-Users <email@hidden>)
 >Re: saving mails... (From: Yvan KOENIG via AppleScript-Users <email@hidden>)
 >Re: saving mails... (From: Yvan KOENIG via AppleScript-Users <email@hidden>)

  • Prev by Date: Re: saving mails...
  • Next by Date: Can one script execute another?
  • Previous by thread: Re: saving mails...
  • Next by thread: Re: saving mails...
  • Index(es):
    • Date
    • Thread