【问题标题】:How do I use applescript to save a Microsoft Word document in a specific Finder folder?如何使用 applescript 将 Microsoft Word 文档保存在特定的 Finder 文件夹中?
【发布时间】:2017-06-14 02:40:02
【问题描述】:

如何使用 applescript 将文件保存在特定文件夹中?

我有一个创建文档的脚本,但我还没有弄清楚如何将文件保存到我想要的位置。这是相关的(我相信)代码:

tell application "Microsoft Word"
    activate
    tell active document
        save as file name SaveName
    end tell
end tell

这样,文件将保存到用户的 Documents 文件夹中。我觉得必须有一种简单的方法可以告诉它将其保存在特定位置,但到目前为止我搜索和尝试的所有内容都没有导致答案。

【问题讨论】:

    标签: applescript


    【解决方案1】:

    例如,如果要将文件保存到桌面文件夹,则需要传递完整路径

    set desktopFolder to path to desktop as text
    tell application "Microsoft Word"
        activate
        tell active document
            save as file name (desktopFolder & SaveName)
        end tell
    end tell
    

    path to desktop as text 等价于"[startup disk]:Users:[current user]:Desktop:"

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-06-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-06-18
      • 1970-01-01
      相关资源
      最近更新 更多