applescript:更新属性?

发布于 2024-12-29 03:24:22 字数 396 浏览 2 评论 0原文

这可能是一个非常基本的问题;

我总是看到

  make new document with properties { x: "1", y: "2", z: 3" }

但是以后如何更新这些属性?

 tell first document

 -- i am trying to set the volume name property 
 set volume name of document to "BLA"
 -- also tried:
 set properties of first document to {volume name:"BLA"}

 end tell

但这根本不起作用,官方语法是什么?网上找不到。

This is probably a very basic question;

I always see

  make new document with properties { x: "1", y: "2", z: 3" }

But how do I update these properties later?

 tell first document

 -- i am trying to set the volume name property 
 set volume name of document to "BLA"
 -- also tried:
 set properties of first document to {volume name:"BLA"}

 end tell

But that doesn't work at all, what is the official syntax? Can't find it online.

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

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

发布评论

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

评论(1

随梦而飞# 2025-01-05 03:24:22

您将需要定位适当的文档(或具有该属性的任何内容),但访问属性的方式与任何其他 记录例如,属性

tell application "whatever"
    set x of document 1 to "5" -- document 1 is usually the front document
    tell document 1 to set x to "5"
end tell

请注意,应用程序属性可能不可写 - 检查其脚本字典。

You will need to target the appropriate document (or whatever has the property), but the properties are accessed the same way as any other record property, for example

tell application "whatever"
    set x of document 1 to "5" -- document 1 is usually the front document
    tell document 1 to set x to "5"
end tell

Note that an application property may not be writable - check its scripting dictionary.

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