gpt4 book ai didi

applescript - 如何使用 AppleScript 访问大纲控件特定行的文本?

转载 作者:行者123 更新时间:2023-12-05 01:08:43 28 4
gpt4 key购买 nike

我正在尝试根据其文本使用 AppleScript 选择大纲的特定行。

这是我正在考虑的(但不起作用):

repeat with aRow in rows of outline 1 of scroll area 1 of splitter group 1 of window 1
set t to text of cell of aRow
if t starts with "some text" then select aRow
end repeat

问题是 text of cell of aRow没有解决我认为应该的问题。
我使用了辅助功能检查器来确认对象层次结构。我试过在行上使用“UI Elements”来查看哪些元素是可访问的,但它没有返回任何有用的信息。所以我没主意了!我错过了什么?

最佳答案

在@markhunte 的提示下,我使用 UI Elements 找出了如何到达大纲中一行的文本。和 get properties .原来是AXRow > AXCell > AXStaticText辅助功能检查器显示的层次结构具有误导性。

每个的文本是通过name of first UI Element of row (of outline...)访问.

这是完成我打算实现的工作代码:

tell application "System Events"
tell process "MyApp"

repeat with aRow in row of outline 1 of scroll area 1 of splitter group 1 of window 1
if name of first UI element of aRow starts with "Schedule" then select aRow
end repeat

end tel
end tell

关于applescript - 如何使用 AppleScript 访问大纲控件特定行的文本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16748479/

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