10 Replies Latest reply: Mar 21, 2013 6:17 PM by red_menace
kentrj99 Level 1 Level 1 (0 points)

I'm trying to create a script or an automator action that takes pdf files I have saved in a specified folder and creates emails with those pdf files as attachments (all of that I can do), with the added complication that I want the subject of each email to match the title of each pdf. This last part is the one that has stumped me. It seems when I take that out of an Applescript, the script works.

 

Below is the Automator action I created. I can get emails with the subjects matching the specified pdf files, but then the attachments aren't attached.

 

 

Please help. Thanks.


iMac, OS X Mountain Lion (10.8.2)
  • 1. Re: Help with Automator!
    kentrj99 Level 1 Level 1 (0 points)

    The pic of my automator actions didn't print above...so here are the steps:

     

    - Get Specified Finder Items

    - Dispense Items Incrementally

    - Get Names of Finder Items

    - Set Value of Variable

    - New Mail Message

    - Add Attachments to Front Message

    - Loop

  • 2. Re: Help with Automator!
    red_menace Level 6 Level 6 (14,610 points)

    Your workflow isn't providing an attachment for the Mail message.  You will need to add extra steps to save/retrieve the file, for example:

     

    1. Get Specified Finder Items
    2. Dispense Items Incrementally
    3. Set Value of Variable (save the original file item)
    4. Get Names of Finder Items
    5. Set Value of Variable (the name for the email subject)
    6. Get Value of Variable (get the file item back - also Ignore Input so the name isn't mixed with the file)
    7. New Mail Message (files passed to the action will be attached)
    8. Loop
  • 3. Re: Help with Automator!
    pjdube Level 3 Level 3 (830 points)

    Kentrj99,

     

    Ok so I looked at your workflow and put it together and found what was happening.

     

    The key action that you need to include in your workflow is Wait for Finder Items. As this gives it time to proccess the PDF file in order to attach it, once it is passed to a variable.

     

    The other thing is that you need more variables in your workflow. See below how I have done this. As you will see also you have to make sure some of the variables do not pass onto the next action.

     

    Here is the workflow, and it works! It does exactly what you need it to do. I have attached as well for you to download it.

     

    Hope that solves it for you!

     

     

     

     

    PDF to Mail with Subject of PDF

  • 4. Re: Help with Automator!
    pjdube Level 3 Level 3 (830 points)

    Sorry forgot to include the images:

     

    1.JPG

    2.JPG

  • 5. Re: Help with Automator!
    kentrj99 Level 1 Level 1 (0 points)

    Thanks for your input. I did this exactly as you laid out. This results in an email with the proper subject, but instead of the attachment in the email, it just has the name of the file.

     

    Any ideas why?

  • 6. Re: Help with Automator!
    kentrj99 Level 1 Level 1 (0 points)

    Unfortunately, I haven't bought and downloaded the Automator Workflows that contain Wait for Finder Items. Think that's the only way to do this?

  • 7. Re: Help with Automator!
    pjdube Level 3 Level 3 (830 points)

    Did you download the workflow I linked, and try taking out the Wait for Finder Items?

     

    How big are the PDF documents? I put in the Wait for Finder Items action as I have found that when they are bigger than 1 mb each then it has to wait until it actually attatches before moving on.

     

    The reason why I am asking is that it works perfectly when I do it.

  • 8. Re: Help with Automator!
    kentrj99 Level 1 Level 1 (0 points)

    I ultimately downloaded the automator actions from the app store, and it has worked for me. Thanks very much.

  • 9. Re: Help with Automator!
    pjdube Level 3 Level 3 (830 points)

    Hey no problem. Totally forgot that I had that 3rd party action. There are a lot of very usefull finder actions that come with that package, which I am finding useful. If you have any other questions let me know.

     

    Phil

  • 10. Re: Help with Automator!
    red_menace Level 6 Level 6 (14,610 points)

    It looks like Automator is geting confused about the original file item (it seems to get confused easily).  One simple solution is to add an action that returns Finder Items (such as Filter Finder Items) after getting the original item variable.