通过AXStaticText在applescript中获取一行

时间:2013-12-06 12:06:45

标签: applescript

value of static text of row 1 of (table 1 of some scroll area)
        --> {"Wi-Fi, Connected"}

select (row of (table 1 of some scroll area)
            whose (value of static text) begins with "Wi-Fi")
error "Can’t get attribute \"AXValue\" of static text."
            number -1728 from «class attr» "AXValue" of «class sttx»

虽然我可以获得该值,但为什么我不能将它用作'which'子句中的过滤器? 感谢。

1 个答案:

答案 0 :(得分:0)

value of static text似乎返回了{"Wi-Fi, Connected"}这样的列表。尝试使用重复循环强制列表文本:

tell application "System Events" to tell process "System Preferences"
    repeat with r in rows of table 1 of scroll area 1 of window 1
        if (value of static text of r as text) starts with "Wi-Fi" then return r
    end repeat
end tell