2017-06-13 113 views
0

如何使用applescript將文件保存在特定文件夾中?如何使用applescript在特定的Finder文件夾中保存Microsoft Word文檔?

我有一個創建文檔的腳本,但我還沒有想出如何將文件保存在我想要的位置。這裏是相關的(我相信)代碼:

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

這樣,文件保存到用戶Documents文件夾。我覺得必須有一個簡單的方法來告訴它將它保存在一個特定的位置,但是我迄今爲止搜索和嘗試的所有內容都沒有得到答案。

回答

0

您需要通過例如一個完整路徑,如果你想將文件保存到桌面文件夾

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:"

相關問題