I'm trying to make an Automator Quick action (Mac OS) that will save images from pdf pages into the same folder where the pdf is located .
**Edit: user3439894 wrote that I should have and did not make totally clear that I want "to send multiple files to the Quick Action from different folders and have the files created in each respective folder the file is in"
I found that it's easy to have files saved to a particular folder; for example, here's a workflow that saves images from a pdf to the desktop:
The hard part is saving to the same folder where the pdf is located. I tried to adapt this answer , but I get: "Rename Finder Items: Name Single Item" encountered an error: "More than one Finder item was passed to Name Single Item". I don't know how to fix that -- the whole point of my task is to output multiple images from the .pdf.
There are actually 2 workflows shown on the stackoverflow page I mentioned above . I tried adapting both of them and they both gave the same error. Below is one of my adaptions. The "Get Specified Finder Items" action is just for testing purposes.
This gets a bit convoluted because Automator doesn't have a default action to get names or paths (that was one of my first actions back in the day), you need to shuffle stuff around while you work at getting items into variables, and workflows handle multiple input items as a single batch.
The Rename Finder Items action will only rename (you need to use the Make Sequential option rather than Name Single Item ), but that doesn't help much, especially since the Render PDF Pages as Images action also uses sequential numbers in its output.
For items with the same parent folder (otherwise a third party action would need to be used to handle the items individually), a Run AppleScript action can be used (as in your linked examples) to get the parent folder for use in a variable, so your workflow would be something like:
Run AppleScript:
on run {input, parameters} tell application "Finder" to return (container of first item of input) as alias end run
I found a way that works for me.
Run AppleScript:
on run {InputPDFs, parameters} tell application "Finder" to return (container of first item of InputPDFs) as alias end run
Set Value of Variable {Variable: PathToPDFs}
The following solution in the screenshot works fine in Catalina (10.15.7).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.