• 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: export multiple emails as PDF
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: export multiple emails as PDF


  • Subject: Re: export multiple emails as PDF
  • From: Jeremy Roussak via AppleScript-Users <email@hidden>
  • Date: Thu, 25 Aug 2022 16:43:35 +0100

I’m not sure how much help this will be, but FWIW this is a script which is run
from a 4D database to retrieve all emails from Amazon since a certain date so
the purchases can be extracted by code within the database. It works, which is
probably all that can be said for it; but what more do you need?

Jeremy

-- return body text of amazon messages since supplied date, separated by
xxxxx<date> lines

on run argv
        set {fromdate} to argv
        set fromdate to date (fromdate)

        try
                tell application "Mail"
                        set acc to some account whose account type is iCloud
and name is "iCloud"
                        set box to acc's mailbox "Misc/Amazon"
                        set msgs to messages of box whose (date received is
greater than fromdate) and ((sender contains "auto-confirm") or (sender
contains "digital-no-reply"))
                        set msgText to ""
                        repeat with msg in msgs
                                set msgDate to msg's date sent
                                tell msgDate
                                        set msgStr to (its day) & "/" & (its
month as integer) & "/" & (its year) as string
                                end tell
                                set msgText to msgText & "xxxxx" & msgStr &
return
                                set msgText to msgText & msg's content
                        end repeat
                end tell

        on error errText
                set msgText to "Error in getAmazonEmails script:" & return &
return & errText

        end try

        return msgText

end run


Jeremy Roussak
Photography: jbr.is <http://jbr.is/>


> On 23 Aug 2022, at 17:17, iKel via AppleScript-Users
> <email@hidden
> <mailto:email@hidden>> wrote:
>
> Hello!
>       I am trying to automate some of my email processes. I am sure I can do
> some of what I want to do with Smart Folders but does anyone have any good
> scripts for email? The main thing right now I am wanting to do is to select
> or retrieve multiple emails and export as PDF and drop it in a folder or
> maybe a note app like Notion. Is there a way to convert multiple emails to
> PDF? I have a working a script but at the moment I need to figure out how to
> grab a specific sender and perhaps loop over all the emails by that sender
> and then export as a PDF. I am not sure if I am even heading in the right
> direction. If anyone has better solutions feel free to provide them! I
> appreciate it!
>
> tell application "Mail"
>       activate
>       —iterate over items within the mailbox
>       set msgs to item 1 of (get every message of mailbox "INBOX" of account
> "Google" whose sender contains "")
>       tell application "System Events"
>               tell application process "Mail"
>                       repeat with msg in msgs
>                               -- or save as a link
>                               click menu item "Export as PDF…" of menu "File"
> of menu bar 1
>                               --place in folder or note app
>                       end repeat
>               end tell
>       end tell
> end tell
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> AppleScript-Users mailing list      (email@hidden
> <mailto:email@hidden>)
> Help/Unsubscribe/Update your Subscription:
> Archives: http://lists.apple.com/archives/applescript-users
>
> This email sent to email@hidden





Jeremy Roussak
Photography: jbr.is


 _______________________________________________
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: 
 >export multiple emails as PDF (From: iKel via AppleScript-Users <email@hidden>)

  • Prev by Date: Re: export multiple emails as PDF
  • Next by Date: Re: export multiple emails as PDF
  • Previous by thread: Re: export multiple emails as PDF
  • Index(es):
    • Date
    • Thread