gpt4 book ai didi

properties - 我可以找出 AppleScript 对象是否具有特定属性吗?

转载 作者:行者123 更新时间:2023-12-03 17:45:35 25 4
gpt4 key购买 nike

我正在尝试编写 BBEdit 脚本,让我在来自 TextMate 时感觉更自在。我需要做的一件事是查看我引用的对象是否具有特定属性。

例如:

tell application "BBEdit"
tell front window
get selected items
end tell
end tell

这将在项目窗口上成功,但在磁盘浏览器窗口上不会成功,因为后者没有“选定项目”属性。如何查看对象中是否有这样的属性?

请注意:我知道如何在脚本编辑器中检查对象(获取属性)以查看它具有哪些属性,但我需要在运行时知道它们是什么。

最佳答案

类(class)呢?

tell application "BBEdit"
if class of window 1 is disk browser window then
# ...
else
# ...
end if
end tell

关于properties - 我可以找出 AppleScript 对象是否具有特定属性吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6938312/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com