Save files to a user-chosen location at runtime?

I have an Automator script that, in almost all respects, works perfectly.

Ask for Finder items - OK

Render PDF pages as Images - OK

Move Finder Items - Problem is here. Apparently, I have to specify a folder when I’m crafting the action. When I specify the Desktop, all the files generated by the previous step end up there. But I’d like the user to specify this folder during runtime. I imagine I’d need a step prior to this one where the user is asked for the folder location and it’s passed to the Move Finder Items step with a variable. But I’m clueless here.

Any assistance will be appreciated. Thank you.


In theory, I suppose you’d use “Ask for Finder Items” again to choose the destination folder, but I can’t see any obvious way — even using Automator variables — to move files to the chosen folder. My instinct, as an AppleScripter, would be to replace everything after “Render PDF Pages as Images” with “Run AppleScript”, using this code in the latter:

on run {input, parameters}
	set destinationFolder to (choose folder with prompt "Choose a destination folder for the images" default location (path to desktop))
	tell application "Finder"
		move input to destinationFolder with replacing
	end tell
	-- input is a list of aliases, so they still point to the files after the move.
	return input
end run


Thank you! It has been so long since I’ve done anything in AppleScript that I was having trouble just trying to imagine what the code might look like. I’m sure I’m not the first person who has cursed Apple for not including this Automator action. Anyway, your code did the trick perfectly.

Stay healthy!


Hi Barry.

If you’re still checking this thread and are interested, I’ve just been watching a video of a talk about Automator and have come upon a couple of similar but different solutions.

The first is a cross between what you originally wanted and the Run AppleScript solution:

The other’s method’s longer, but doesn’t involve any AppleScript:

If I find a non-AppleScript method involving fewer actions, I’ll post it!


Yes; I always keep the subscription to a thread here active simply because you never know when someone is kind enough (you, in this case) to provide add’l helpful material. Thank you very much!

When I started with this little project, I found that the text prompts Automator used to provide are no longer present in Sierra (I read that happened a few macOS upgrades ago) so the add’l AppleScript prompt before the dialog appears works around that deficiency.


Hmm. I didn’t notice that. The prompt parameter’s still there in the action, so the lack of a prompt in the dialog must be a bug.

An equivalent AppleScript to ask for the PDFs at the top of the workflow would look something like this:

set output to (choose file of type {"com.adobe.pdf"} with prompt "Select the PDF file(s) you want to process" default location (path to desktop) with multiple selections allowed)

return output

I’ve added a comment to the script in post #2 explaining that returning input as the output is in fact correct. :slight_smile:


Last I heard, this bug was never going to be fixed.

Thank you, though, for your update to post #2. I tend to comment my code liberally (I normally use Livecode) as I’ll never remember what I was attempting to do when I come back to it six months later. :smiley: