0
votes

I've created a flow where:

  1. Emails are received containing linked buttons (HTML)
  2. A mail rule triggers an Applescript that sends the source code to Automator
  3. Automator Extracts URLs from the code
  4. Automator Filters URLs to just ".PDF" extensions (the file type I'm trying to download)
  5. Automator downloads the URL (PDF)

From there I have a workflow that automatically prints new files saved in a particular folder (my ultimate goal).

This works perfectly for what I need except in the source code of the email, the link is included twice. The system thinks it them has to download two copies of the file and as a result, two copies are printed.

I'm trying to figure out a solution where, either:

  • Between steps 4 & 5 above, only the first line is downloaded
  • Between steps 4 & 5 above, duplicates are removed
  • Upon download, the folder deletes duplicates
  • Or another solution I haven't thought of that would achieve this

Any help is greatly appreciated!

1
If there is an Applescript routine I could add into Automator that deleted line 2 of 2, I'd be set - Steve

1 Answers

0
votes

Apply this code to your Run AppleScript Action, after step #3:

on run {input, parameters}  
    set firstURL to item 1 of input
    return firstURL
end run