1 2 Previous Next 22 Replies Latest reply: Nov 20, 2013 1:55 PM by acolyte_x
Gerben Wierda Level 1 Level 1 (125 points)

I have created my first Automator workflow. Pretty simple, I have used the PDF to image action. Now, this works, but the file is saved somewhere in /var/folders. What I want is a service that takes the selected PDF files and renders them to JPEG at a certain dpi and quality (so far so good) but that then saves it next to the PDF file already there. I tried getting tthe filename and using that in a follow-up action, but that hasn't worked. I can get the rendered image file in a mail message and I can see it ending up in /var/folders when I just use the PDF to image action.

 

But I can't find an action or combination of actions that gets me the result file in the right location (same as source).

 

Can someone help?

  • 1. Re: newbie automator question: save file
    Gerben Wierda Level 1 Level 1 (125 points)

    Nobody?? It can't be done? No Apple Genius who knows this?

  • 2. Re: newbie automator question: save file
    Frank Caggiano Level 7 Level 7 (23,820 points)

    If you posted your workflow it would be easier to try to help. Guessing at what you are doing isn't going to be of much help.

     

    regards

  • 3. Re: newbie automator question: save file
    Gerben Wierda Level 1 Level 1 (125 points)

    OK, thanks for wanting to help. I thought I had posted my workflow. It is a Service Workflow that consists of one single Library Action: from the PDFs Actions I have the Action "Render PDF Pages as Images". What this action does is create jpeg files. If I select the file Foo.pdf in Finder and select the service, I end up with Foo.jpeg in a temporary directory somewhere in /var/folders.

     

    If you mean something different by 'posting my workflow', please tell me what you mean. I can post the XML in the document.wflow inside the Contents of the .workflow bundle (but that is just a standard Automator Library action)

  • 4. Re: newbie automator question: save file
    Frank Caggiano Level 7 Level 7 (23,820 points)

    By posting the workflow I meant to post a screen capture of the workflow open in Automator. Just makes it easier and less prone to error if we can see what you have actually done.

     

    But I think in your case try adding a Move Finder Items after the Render PDF Pages as Images. That should allow you to put the files where you like.

     

    Screen Shot 2012-08-18 at 08.08.58.png

     

    Post back if that isn;t what you are looking to do.

     

    regards

  • 5. Re: newbie automator question: save file
    Gerben Wierda Level 1 Level 1 (125 points)

    Thanks & yes that I what I am doing. I looked at that Move Finder Item Action. But that only gives me the possibility to put it somewhere static and specific. I want the resulting JPEG to end up next to the PDF I have rendered. I do not want all of them to end up together in one big heap in a single location.

     

    So what I have been trying to find is a way to find out the directory part of the file path sent to this service, then use that directory part of the file path as the target for Move Finder Item.

  • 6. Re: newbie automator question: save file
    pjdube Level 3 Level 3 (830 points)

    I can help you with this, but please post what you have worked out so far as Frank says. It will make it easier for us to see what exactly you are trying to accomplish and where we can help.

  • 7. Re: newbie automator question: save file
    Gerben Wierda Level 1 Level 1 (125 points)

    Two step workflow now (as depicted above by Frank):

     

    Service receives selected PDF files in Finder.app

    1. Render PDF Pages as Images

    2. Move Finder Items (replace existing) to a fixed folder on my Desktop

     

    But what I'd really like is if the JPEG renders would end up next to the original PDF files in the directory where the PDF file came from. I have been trying a few things, but none of these have worked. So, the JPEG files keep up ending in that same target folder.

     

    What I want to do (but don't know how in Automator)

     

    1. From a selected PDF file in Finder, split the full path into folder, basename,'.pdf'

    2. Create folder/basename.jpeg from folder/basename.pdf

  • 8. Re: newbie automator question: save file
    pjdube Level 3 Level 3 (830 points)

    I am still confused with what you want exactly, But I think you should start with this. This will make images of the PDF and file it in the parent folder of where you got the PDF from.

     

    Screen Shot 2013-03-31 at 6.01.48 PM.JPG

    Screen Shot 2013-03-31 at 6.02.02 PM.JPG

  • 9. Re: newbie automator question: save file
    Gerben Wierda Level 1 Level 1 (125 points)

    That looks indeed like what I want. But where is the "Get Parent Folder" action? I can't find it in my Automator (10.7.5).

  • 10. Re: newbie automator question: save file
    Gerben Wierda Level 1 Level 1 (125 points)

    I found this as AppleScript in the forums

     

    on run {input, parameters}
    set pathList to {}
    repeat with itemNum from 1 to count of input
    tell application "System Events"
    copy POSIX path of (container of (item itemNum of input)) to end of pathList
    end tell
    end repeat
    return pathList
    end run

     

    But how do I get that into an action?

  • 11. Re: newbie automator question: save file
    pjdube Level 3 Level 3 (830 points)

    Get Parent Folder is a 3rd party action.

     

    You can download it here: http://code.google.com/p/automator-actions/

  • 12. Re: newbie automator question: save file
    pjdube Level 3 Level 3 (830 points)

    Did this help you? Otherwise I will try to find another way to go about it and post back.

  • 13. Re: newbie automator question: save file
    Gerben Wierda Level 1 Level 1 (125 points)

    I am in the difficult process of upgrading my 10.6.8 Server to 10.8 Server, so I can get back to  this after that has succeeded. Apologies.

  • 14. Re: newbie automator question: save file
    Gerben Wierda Level 1 Level 1 (125 points)

    Almost there. But what I can't do is use the "Original Folder" variable in the final "Move Finder Items" action. How do I set that? "Move Finder Items" only gives met the options of a list of directories and a "New Variable" which turns out to be a fixed variable I can set to a certain fixed folder.

     

    Screen Shot 2013-04-03 at 3 April 18.07.45.png

     

    How do I use that "Original Folder" variable for "Move Finder Items"?

1 2 Previous Next