AppleScript将拖动的文档传递给另一个应用程序



感谢在这些精美页面上收到的帮助,我的Mac有了一个小AppleScript来打开Adobe Distiller的新会话。

do shell script "open -n -a " & quoted form of "Acrobat Distiller"

新问题,要求对此进行一点改进。如果一个.ps被拖动(或者实际上,几个被拖动(到这个.scpt制作的.app,Distiller的新会话会用那个文档(或者那几个文档(打开吗?

谢谢。

将以下脚本保存为应用程序。如果您运行该应用程序,它将允许您选择要在新实例中打开的文件;如果你把文件放在上面,它会在一个新的实例中打开所有文件:

on run
set filesToOpen to choose file with multiple selections allowed
set fileListString to createUnixFileString(filesToOpen)
makeNewInstanceWithFiles(fileListString)
end run
on open droppedFiles
set fileListString to createUnixFileString(droppedFiles)
makeNewInstanceWithFiles(fileListString)
end open
on createUnixFileString(aList)
set fileString to ""
repeat with thisItem in aList
set fileString to fileString & " " & quoted form of (POSIX path of thisItem)
end repeat
return fileString
end createUnixFileString
on makeNewInstanceWithFiles(f)
do shell script "open -n -a " & quoted form of "Acrobat Distiller" & f
end makeNewInstanceWithFiles

如果希望在单独的实例中打开每个文件,请为每个文件调用makeNewInstanceWithFiles(确保获取posix路径并包含一个空格作为分隔符(,而不是调用createUnixFileString处理程序。

相关内容

最新更新