【发布时间】:2020-04-21 10:50:27
【问题描述】:
我尝试将 docx 转换为 pdf 并通过从原始文件名中获取一些字母来重命名文件。
在 Automator 中,我使用了“Get Specified Finder Items”和“Run AppleScript”。
我执行并在 Microsoft Word 中收到一条弹出消息
“无法导出文件。出了点问题,您的文件现在无法导出。请稍后再试。”
任何人有任何想法有什么问题吗?请帮帮我。 谢谢。
- Microsoft Word:16.35 (20030802)
- 自动机:2.10 (492)
- macOS:10.15.4
on run {input, parameters}
repeat with aFile in input
tell application "Microsoft Word"
launch
try
open aFile
tell document 1
set fileName to aFile as text
set newName to "p" & (text 14 thru 15 of fileName) & "-" & (text 11 thru 12 of fileName) & "-" & (text 8 thru 9 of fileName)
set pdfOutput to (newName & ".pdf")
save as file name pdfOutput file format format PDF
end tell
close document 1 saving yes
on error
try
close document 1 saving no
end try
end try
end tell
end repeat
return input
end run
【问题讨论】:
标签: ms-word applescript automator