Tell me more ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I will potentially have 26k of old legacy PICT images to transfer first to PDF for migration. I am using Apple Automator and also the "Dispense Items Incrementally" to loop through it. However, I can't seem to let "New PDF from Images" to remember the original filename. Anyone able to offer some advice :)

FYI, I am transforming it to PDF because I can't do it using ImageMagick to convert directly to my ultimate JPEG format. Due to the fact that my PICT was created very long ago and thus has some convert: improper image header error. See this ticket for more information.

Thus I am doing a intermediate convert PICT to PDF first, then convert that PDF to JPEG :)

The only thing left is the naming of the "Output File Name" which do not allow me to identify original filename.

See the screen here:

share|improve this question

1 Answer

up vote 1 down vote accepted

The solution is to use Automator's variables to store the filename, then rename it after.

Add the following actions after the Dispense Items Incrementally action:

  • Set Value of Variable, with a new variable named file. This keeps track of the file for later.
  • Run Shell Script. Set Shell to /bin/bash (this should be the default) and Pass input to as arguments. Replace the text with this:

    name=`basename "$1"`
    echo ${name%.*}
    
    • This extracts just the filename, without any extension or path.
  • Set Value of Variable, with a new variable named filename.
  • Get Value of Variable, with the variable set to file.

Then, run your conversion as you already have it. After that (but before the loop), add this action:

  • Rename Finder Items. Set the first drop-down to Name Single Item, the second to Basename Only, then drag and drop the filename variable into the text box. If you don't see the variables, click View → Variables, and the variables panel will appear from the bottom.
share|improve this answer
How can I repay you for such great step by step answer. It just save my automation day :) YOU ROCK! – mech Dec 4 '12 at 2:16
Glad it helped! – robmathers Dec 4 '12 at 2:55

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.