自动操作 工作流程失败:期是行的结尾等等,却找到类名称

网上找到一个Word批量转换成PDF的Applescript代码,但是copy下来运行时报错:预期是行的结尾等等,却找到类名称。

错误-212,代码如下,求指导!


on run {input, parameters}

  set theOutput to {}

  tell application "Microsoft Word"

    repeat with thefile in input

      open thefile

      set pdfPath to my makeNewPath(thefile)

      set theActiveDoc to the active document

      save as theActiveDoc file format format PDF file name pdfPath

      close theActiveDoc saving no

      Tell application”Finder”to delete thefile

    end repeat

  end tell

  return theOutput

end run


on makeNewPath(f)

  set d to f as string

  if d ends with ".docx" then

    return (text 1 thru -5 of d) & "pdf"

  else if d ends with ".doc" then

    return (text 1 thru -4 of d) & "pdf"

  else

    return d & ".pdf"

  end if

end makeNewPath

发布日期 2022年7月2日 上午7:14

回复
回复量: 3

这个主题已被系统或社区团队关闭。 你可以为你认为有帮助的任何帖子投票,也可以在社区中搜索其他答案。

自动操作 工作流程失败:期是行的结尾等等,却找到类名称

欢迎来到 Apple 支持社区
Apple 客户在其产品方面互相帮助的论坛。使用您的 Apple 帐户开始畅游其中吧!!