第 09 页和 applescript,将当前文件另存为 .doc 并覆盖当前文件

发布于 2024-10-15 19:08:11 字数 145 浏览 3 评论 0原文

我想将当前打开的文件另存为 .doc 覆盖当前文件。 所以我必须找到当前打开的文档路径,然后将当前文件保存在同一路径上,另存为 .doc

任何人都可以帮忙吗?我尝试过很多方法但总是失败... (我使用的是 OSX 10.6,第 09 页)

谢谢

I want to save current opened file as .doc overwriting the current file..
so I have to find the current opened document path, then save the current file on the same path, saving as .doc

Anyone can help? I've tried in many ways but always failed...
(I'm on OSX 10.6 with pages 09)

thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

↙厌世 2024-10-22 19:08:11

尝试一下:

tell application "Pages" to tell document 1
   set oldname to name
   set oldPath to get path
   try
       set docPath to oldPath
   on error
       set oldPath to (path to documents folder as text) & oldname & ".pages"
       save in oldPath
   end try
   tell application "System Events" to set oldPath to path of disk item oldPath
   if oldPath ends with ":" then set oldPath to text 1 thru -2 of oldPath (* useful is the app saves as packages *)
   set docPath to text 1 thru -(1 + (count of "Pages")) of oldPath & "doc"
   save as "Microsoft Word 97 - 2004 document" in docPath
end tell

来源:MacScripter,所以你可能需要稍微摆弄一下。

Give this a whirl:

tell application "Pages" to tell document 1
   set oldname to name
   set oldPath to get path
   try
       set docPath to oldPath
   on error
       set oldPath to (path to documents folder as text) & oldname & ".pages"
       save in oldPath
   end try
   tell application "System Events" to set oldPath to path of disk item oldPath
   if oldPath ends with ":" then set oldPath to text 1 thru -2 of oldPath (* useful is the app saves as packages *)
   set docPath to text 1 thru -(1 + (count of "Pages")) of oldPath & "doc"
   save as "Microsoft Word 97 - 2004 document" in docPath
end tell

Source: MacScripter, so you may need to fiddle with it a bit.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文