Mac Yosemite 10.10.2。假设我有两个pdf,myPdf1.pdf和myPdf2.pdf,位于/ myFolder中。我想要一个执行以下操作的服务或脚本:
我尝试了很多无法解决的问题。我从这里开始Mac Automator - Combine PDF files, save in same folder
我的问题在于最后一步:将Finder项目移动到containerPath。我合并的pdf将转移到桌面。
答案 0 :(得分:0)
我找到了一个使用AppleScript的解决方法,它可以绑定到Automator服务或应用程序中。我没有重命名输入的pdfs,而是将它们移动到文件夹中。
on run {input, parameters}
tell application "Finder"
set trashFolder to "MacHD:path:to:some:folder"
set outputFolder to container of (item 1 of input)
set outputName to name of (item 1 of input)
set outputFile to (outputFolder as text) & outputName
repeat with p in input
move p to trashFolder with replacing
end repeat
set pdfFiles to ""
repeat with p in input
set pdfFiles to pdfFiles & " " & quoted form of POSIX path of p
end repeat
--display dialog outputFile
--display dialog pdfFiles
do shell script "/System/Library/Automator/Combine\\ PDF\\ Pages.action/Contents/Resources/join.py " & "-o " & quoted form of POSIX path of outputFile & pdfFiles
return outputFile as alias
end tell
结束