I'm using Automator to combine PDF files, but can't figure out how to automate saving the resulting file to the same folder. (Instead, it asks me where to put the file.)
I'm using it as a service - here's my existing workflow:
1) Service receives selected -PDF files- in -any application-
2) Combine PDF Pages [appending pages]
3) Rename Finder Items: Name Single Item [Name Single Item, Basename only, to "TestResults"]
4) Move Finder Items [to a folder - show action when workflow runs]
Ideally, I'd love the resulting file:
-- to be named based on (the folder where it's located) + (an appended static string)
-- saved in the folder where the files are
I've seen other solutions where people are Getting and Setting Variable Values, but when I've tried, it only seems that I'm naming the variables, not actually telling the program where to get the values.
(In my case, I was creating a variable called "folderPath" and trying to pass that along to the Move Finder Items action.)
Thanks to jweaks for his script. Super helpful and elegant.
I found and fixed a small bug:
I got his workflow to put the file into the same folder as the original PDFs rather than on the desktop by tweaking the Applescripts to talk to the Finder (instead of System Events) and return an alias, which seems to be what Move Finder Items is expecting:
So…
Revised Applescript:
on run {input}
tell application "Finder" to return (container of item 1 of input) as alias
end run
Revised Applescript 2
on run {input, parameters}
-- the input is the enclosing folder which was output from the previous Applescript
tell application "Finder" to return name of (item 1 of input)
end run
Set Value of Variable : containerName
Get Value of Variable : originalPDFs ; select Options > "ignore this action’s input"
Hope this helps… I’m sure I’ll look up this answer again in a few years :)
Here’s a screenshot:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With