Need help with Automator workflow

I’m making a simple workflow to:

  1. fetch 10 different pdf documents located on a server in various folders
  2. combine them into a single pdf
  3. save the pdf with a specific name and overwrite that name each time the workflow is run (same name each time)

I have steps 1 and 2 working fine, but I can’t find a simple “rename” or “save-as” automator flow in those included with OS X. The “Combine PDF pages” seems to pass a weird filename that may be made of the first letter of each filename in addition to some obscure number at the beginning of the filename. If I use the “Rename Finder Items” flow, it wants to know what text to replace, and the text passed by the previous flow is not always the same…kind of hard to explain.

So, is there a trick to the “Rename…” workflow, maybe a wildcard to use?

What is the naming convention for the “Combine PDF pages” flow?

Why isn’t there a “Delete finder item” workflow?

Thanks

Steve

I should have been more specific in the post above. I’m looking for a workflow action to simply take the name of the finder item and change the name to a name of my choosing, overwriting the file each time the flow is run. Do I need Applescript rather than Automator?

Hi Steve

use this script in a Automator > Run AppleScript action to save the file.
You have to specify the path in the “set pathtoSave.” line

on run {input, parameters}
	set pathToSave to POSIX path of (path to desktop) & "TestPDF.pdf"
	set theSource to quoted form of POSIX path of item 1 of input
	do shell script "cp -f " & theSource & " " & quoted form of pathToSave
	return POSIX file pathToSave as alias
end run

a “Delete Items” can be realized with this Run AppleScript action

on run {input, parameters}
	tell application "Finder" to delete input
	return input
end run

Stefan, thanks for the quick response. I assume I have to change the ““pathToSave” in all 3 locations within the script? And can '(path to desktop)” be replaced with any path I want?

Thanks again

Steve

Yes and no.

You have to change the path only in the first line.
path to desktop is a special expression and returns the alias to the desktop of the current user.
You can also use a path like

set pathToSave to POSIX path of "Mac HD:Users:myUser:Path:to:myPDF.pdf".

this is the same as

set pathToSave to POSIX path of (path to home folder) & "Path:to:myPDF.pdf"

Thanks, this is working out well.

Next question - is the Automator flow “Rename Finder Items” somewhat buggy? I can get it to rename files, however it does not seem to pass the new filename information onto the next flow. If I use the “Rename” flow and follow it with a “Copy” flow, the rename works and the copy does not, same if I use two Rename flows in a row, the first works, the second does not always work.

Sorry, I have no idea. I regard Automator as some GUI for AppleScript and I don’t need (and use) it at all :wink: