没有更多的废话,直接上代码,代码的注释应该很清楚了。
property word_docs : {"org.openxmlformats.wordprocessingml.document", "com.microsoft.word.doc"}
property default_path : (path to desktop) as alias
property Delim : {".docx", ".doc"}
property PDF : ".pdf"
set outPDF to {}
-- 打开文件选择对话框,只允许选择Word文档,并将所选文件存储在变量 selected_files 中
set selected_files to (choose file of type word_docs default location default_path with multiple selections allowed without invisibles and showing package contents)
-- 将Word文档的扩展名替换为PDF,并将PDF文件路径添加到 outPDF 列表中
set {TID, AppleScript's text item delimiters} to {AppleScript's text item delimiters, Delim}
repeat with afile in selected_files
copy item 1 of text items of (afile as text) & PDF to the end of outPDF
end repeat
set AppleScript's text item delimiters to TID
-- 使用Microsoft Word应用程序对象
tell application id "com.microsoft.Word"
-- 将M