【发布时间】:2014-06-27 14:07:41
【问题描述】:
在@chuck 和其他董事会帖子的大力帮助下,我收集了一个applescript,以有效地批量打印从filemaker 容器导出的文件列表到我桌面上一个名为“print”的文件夹。
我现在遇到的问题是其中一些容器导出不是 PDF(它是 Jpg、PNG、Tif 和 PDF 的混合),并且无法使用 acrobat 打开(使用 PDF 或任何其他 PDF 查看器的预览)由于各种原因,这是不可能的)...由于来自 acrobat 的错误消息必须手动关闭,脚本才能继续执行下一个文件,因此此问题有效地关闭了工作流程。
我的问题是能否命令 applescript 先确定文件类型,然后选择不同的程序来打开文档并触发打印命令并关闭窗口,然后再移动到序列中的下一个文档。
(即如果是 .pdf 则使用 acrobat 打印关闭窗口,如果不使用预览打开文件,则打印关闭窗口,重复直到打印完所有文件。)
以下是我当前的工作代码。(仅供参考)此脚本在文件生成器脚本中运行,该脚本在桌面上创建“打印”文件夹并将容器字段导出到该文件夹。 p>
`set myFolder to (path to desktop folder as text) & "Print:"
set myfiles to list folder myFolder without invisibles
repeat with myfile in myfiles
set mycurrentfile to ((myFolder as string) & (myfile as string)) as string
batchprint(mycurrentfile)
end repeat
on batchprint(mycurrentfile)
tell application "Adobe Acrobat Pro"
activate -- bring up acrobat
open alias mycurrentfile -- acrobat opens that new file
tell application "System Events"
tell process "Acrobat"
click menu item "Print..." of menu 1 of menu bar item "File" of menu bar 1
click button "Print" of window "Print"
tell application "System Events"
tell process "Acrobat"
click menu item "Close" of menu 1 of menu bar item "File" of menu bar 1
end tell
end tell
end tell
end tell
end tell
tell application "Finder" -- to move the printed file out
set x to ((path to desktop folder as text) & "Printed PDFs:")
if alias x exists then
beep
else
make new folder at the desktop with properties {name:"Printed PDFs"}
end if
move alias mycurrentfile to folder "Printed PDFs"
end tell
结束批处理`
【问题讨论】:
标签: pdf applescript containers batch-processing filemaker