Hello. I’ve been browsing this community for a while and this is my first dive into automation – long time reader, first time writer (who has searched!).
I am using Automator to run a workflow that consists of:
- Get New Mail
- Find Mail Messages (filter by unread and subject line)
- Applescript that seems to output the RAW email message
I am having issues with next steps, aiming to:
4. Search the RAW email message and download the first URL (“https://*.csv”)
5. Save the CSV file to a folder
6. Create a new email, attach the CSV, and send the email
7. Delete the CSV
I’m stuck on Step 4, and Automator’s built-in “Extract data from text” unfortunately did not do the trick. I can successfully get the RAW email output, which looks like the code below, but I cannot figure out how to extract the URL:
[format]{class:message, mailbox:mailbox “[Gmail]/All Mail” of account id
… misc. email headers …
… HTML …
Download URL: https://www.example.com/a/b/c/random.csv
… More HTML …
Download URL: https://www.example.com/a/b/c/random.csv (same link repeated)
"}[/format]
Here is a screenshot of my workflow to-date:
Here is the Applescript I have in Step 3 that outputs the RAW email message:
-- This script accepts an input which is a list of message objects from Mail and returns their properties.
-- The properties returned are in the form of an AppleScript properties record.
on run {input, parameters}
tell application "Mail"
set output to {}
repeat with thisMessage in input
set output to output & (properties of thisMessage)
end repeat
end tell
return output
end run
Thanks in advance!