如何使用AppleScript访问outline控件特定行的文本?

如何使用AppleScript访问outline控件特定行的文本?,applescript,nsoutlineview,Applescript,Nsoutlineview,我正在尝试使用AppleScript根据其文本选择大纲的特定行 以下是我正在考虑的(但不起作用): 问题是aRow单元格的文本不能解决我认为应该解决的问题。 我已经使用了可访问性检查器来确认对象层次结构。我尝试在行中使用“UI元素”来查看哪些元素是可访问的,但它没有返回任何有用的内容。所以我不知道!我缺少什么?我想你缺少的是静态文本 下面是iTunes的一个例子 tell application "System Events" tell process "iTunes"

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

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

问题是aRow单元格的
文本不能解决我认为应该解决的问题。

我已经使用了可访问性检查器来确认对象层次结构。我尝试在行中使用“UI元素”来查看哪些元素是可访问的,但它没有返回任何有用的内容。所以我不知道!我缺少什么?

我想你缺少的是静态文本

下面是iTunes的一个例子

    tell application "System Events"
        tell process "iTunes"

            --  get properties of every static text in rows of outline 1 of scroll area 1 of splitter group 1 of window 1

            get properties of first static text in rows of outline 1 of scroll area 1 of splitter group 1 of window 1 whose description is "sources"
            get properties of first static text in rows of outline 1 of scroll area 1 of splitter group 1 of window 1 whose name is "LIBRARY"
            get properties of first static text in rows of outline 1 of scroll area 1 of splitter group 1 of window 1 whose value is "Spanish"


        end tell
    end tell

在@markhunte的提示下,我通过使用
UI元素
get属性
找到了大纲中一行的文本。事实证明,辅助功能检查器显示的
AXRow>AXCell>AXStaticText
层次结构具有误导性

每一行的文本都是通过行(大纲…)的第一个UI元素的名称来访问的

以下是我想要实现的工作代码:

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进行自动化UI测试。我是AppleScript的新手,为什么这会有关系?因为如果我们可以自己尝试访问大纲,这会有所帮助。并不是所有的应用程序都能像你期望的那样让你访问这些信息。作为开发人员,您应该能够自己命名对象并输入任何相关信息。但是我自己没有试过。顺便说一下,如果你正在开发它的话。最好是让它可以编写脚本,而不是让用户在GUI上纠缠不清。看一看,谢谢马克,你给我看了“获取属性”的东西,让我走上了正确的道路。实际答案略有不同,因为我被可访问性检查员误导了。我的回答中有更多细节。再次感谢!很高兴这有帮助。很久没有玩GUI脚本了,我忘记了大部分。不是我的最爱。
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