我可以使用苹果脚本或自动机器将.doc自动化为.htm吗?

时间:2014-04-17 20:17:53

标签: applescript automator

正如我所见,没有办法将.doc文件转换为.htm,“转换自动文件中的Word文档格式”,不保存为.htm,以及applescript word functions

我也没有看到它(

2 个答案:

答案 0 :(得分:0)

是。 unix命令行实用程序" textutil"可以做到。像这样的东西。请注意,由于您要转换为html,我们可以使用命令行实用程序" tidy"在写入文件之前清理html代码。

set docFile to choose file
do shell script "/usr/bin/textutil -stdout -format doc -convert html " & quoted form of POSIX path of docFile & " | /usr/bin/tidy -ib -utf8 -output " & quoted form of POSIX path of ((docFile as text) & ".html")

答案 1 :(得分:0)

您可以在AppleScript中执行此操作:

tell application "Microsoft Word"
    save as active document file name "converted.html" file format format HTML
end tell

文件名应该是您希望使用旧式Mac路径创建的位置的路径,例如Macintosh HD:Users:somebody:Desktop:converted.html