Pdf Applescript(如果/然后)确定文件类型并选择正确的程序打开和打印文件(在批处理顺序内)

Pdf Applescript(如果/然后)确定文件类型并选择正确的程序打开和打印文件(在批处理顺序内),pdf,applescript,containers,batch-processing,filemaker,Pdf,Applescript,Containers,Batch Processing,Filemaker,在@chuck和其他董事会帖子的大力帮助下,我挑选了一个applescript,有效地批量打印从filemaker容器导出到桌面上名为“print”的文件夹中的文件列表 我现在遇到的问题是,其中一些容器导出不是PDF(它是Jpg、PNG、Tif和PDF的混合体),并且不会使用acrobat打开(使用PDF预览或任何其他PDF查看器是不可能的,原因有很多)。。。由于acrobat发出的错误消息必须在脚本继续下一个文件之前手动单击关闭,因此此问题实际上会关闭工作流 我的问题是,是否可以先命令appl

在@chuck和其他董事会帖子的大力帮助下,我挑选了一个applescript,有效地批量打印从filemaker容器导出到桌面上名为“print”的文件夹中的文件列表

我现在遇到的问题是,其中一些容器导出不是PDF(它是Jpg、PNG、Tif和PDF的混合体),并且不会使用acrobat打开(使用PDF预览或任何其他PDF查看器是不可能的,原因有很多)。。。由于acrobat发出的错误消息必须在脚本继续下一个文件之前手动单击关闭,因此此问题实际上会关闭工作流

我的问题是,是否可以先命令applescript确定文件类型,然后选择其他程序打开文档,触发打印命令并关闭窗口,然后再继续下一个文档。

(即,如果为.pdf,则使用acrobat打印关闭窗口,如果不使用预览打开文件,则使用打印关闭窗口,重复此操作,直到所有文件都已打印完毕。)

下面是我当前的工作代码。(仅供参考)此脚本在filemaker脚本中运行,该脚本正在桌面上创建“打印”文件夹,并将容器字段导出到该文件夹

将myfiles设置为列出文件夹myFolder而不显示

set mycurrentfile to ((myFolder as string) & (myfile as string)) as string
batchprint(mycurrentfile)
在myfiles中重复myfile

set mycurrentfile to ((myFolder as string) & (myfile as string)) as string
batchprint(mycurrentfile)
结束重复

批打印上的
(mycurrentfile)


结束Batch Print`

使用Finder测试文件类型和扩展名,然后使用Acrobat告诉block它是否是pdf,如果不是,则使用Preview或其他方法。 以下是用于此目的的代码结构:

tell application "Finder" to set {fType, nExt} to ({file type, name extension} of file mycurrentfile)
if (fType is "PDF ") or (nExt is "pdf") then
    -- Open mycurrentfile with Acrobat
    tell application "Adobe Acrobat Pro"
    ...     
else
    -- Open mycurrentfile with something else
    tell application "Preview"
    ...
end if
tell application "Finder" to set {fType, nExt} to ({file type, name extension} of file mycurrentfile)
if (fType is "PDF ") or (nExt is "pdf") then
    -- Open mycurrentfile with Acrobat
    tell application "Adobe Acrobat Pro"
    ...     
else
    -- Open mycurrentfile with something else
    tell application "Preview"
    ...
end if