这是一个处理程序,它将返回属于特定UI element 的所有properties、attributes 和actions 的记录:
on info about UIElement
set my text item delimiters to linefeed & linefeed
tell application id "com.apple.SystemEvents" to script Object
property parent : UIElement
property AXAttributes : a reference to my (the ¬
attributes whose name ≠ "AXURL")
property AXValues : value of AXAttributes
property AXRecord : a reference to the ¬
contents of {«class usrf»:my AXList}
property AXList : name of AXAttributes
end script
tell (a reference to the Object's AXList) to set the ¬
contents to paragraphs of (it as text) & ""
tell the Object to repeat with i from 1 to length of its AXValues
set item (i * 2) of its AXList to ¬
item i of its AXValues
end repeat
tell application id "com.apple.SystemEvents" to return ¬
{UI element:the Object's contents} & the properties ¬
of the Object & (the Object's AXRecord as any) & ¬
{_AXActions:every action's name of the Object}
end info
要使用它,请将特定 UI element 的引用传递给它,例如由click或者click at命令。在您的情况下,这可能是:
tell application id "com.apple.systemevents" to tell process "Umsatz"
return info about window 1's sheet 1's text field 1's ui element 1
它仅适用于单个元素,因此将元素集合传递给它会引发错误。成功后,在运行以下命令时,您将在脚本编辑器中获得类似返回的有关我的窗口的详细信息的结果:
tell application id "com.apple.systemevents" to tell process ¬
"Script Editor" to return my info about window 1
Result:
{UI element:window "Untitled 161.scpt" of application
process "Script Editor" of application "System Events",
minimum value:missing value, orientation:missing value,
position:{1000, 25}, class:window, accessibility
description:missing value, role description:"standard
window", focused:false, title:"Untitled 161.scpt",
size:{623, 1095}, help:missing value, entire contents:{},
enabled:missing value, maximum value:missing value,
role:"AXWindow", value:missing value,
subrole:"AXStandardWindow", selected:missing value,
name:"Untitled 161.scpt", description:"standard window",
AXFocused:false, AXFullScreen:false, AXTitle:"Untitled
161.scpt", AXChildrenInNavigationOrder:{application "System
Events", application "System Events", application "System
Events", application "System Events", application "System
Events", application "System Events", application "System
Events", application "System Events", application "System
Events", application "System Events", application "System
Events"}, AXFrame:{1000, 25, 1623, 1120}, AXPosition:{1000,
25}, AXGrowArea:missing value, AXMinimizeButton:button 3 of
window "Untitled 161.scpt" of application process "Script
Editor" of application "System Events",
AXDocument:"file:///Users/CK/Library/Mobile%20Documents/com~
apple~ScriptEditor2/Documents/Untitled%20161.scpt",
AXSections:{{SectionUniqueID:"AXToolbar",
SectionDescription:"Toolbar"},
{SectionUniqueID:"AXContent",
SectionDescription:"Content"},
{SectionUniqueID:"AXTopLevelNavigator",
SectionDescription:"Top Level Navigator"}},
AXCloseButton:button 1 of window "Untitled 161.scpt" of
application process "Script Editor" of application "System
Events", AXMain:true, AXActivationPoint:{1010, 39},
AXFullScreenButton:button 2 of window "Untitled 161.scpt"
of application process "Script Editor" of application
"System Events", AXProxy:missing value,
AXDefaultButton:missing value, AXMinimized:false,
AXChildren:{group 1 of window "Untitled 161.scpt" of
application process "Script Editor" of application "System
Events", busy indicator 1 of window "Untitled 161.scpt" of
application process "Script Editor" of application "System
Events", static text "Running…" of window "Untitled
161.scpt" of application process "Script Editor" of
application "System Events", radio group 1 of window
"Untitled 161.scpt" of application process "Script Editor"
of application "System Events", splitter group 1 of window
"Untitled 161.scpt" of application process "Script Editor"
of application "System Events", toolbar 1 of window
"Untitled 161.scpt" of application process "Script Editor"
of application "System Events", tab group "tab bar" of
window "Untitled 161.scpt" of application process "Script
Editor" of application "System Events", button 1 of window
"Untitled 161.scpt" of application process "Script Editor"
of application "System Events", button 2 of window
"Untitled 161.scpt" of application process "Script Editor"
of application "System Events", button 3 of window
"Untitled 161.scpt" of application process "Script Editor"
of application "System Events", static text "Untitled
161.scpt" of window "Untitled 161.scpt" of application
process "Script Editor" of application "System Events"},
AXRole:"AXWindow", AXParent:application process "Script
Editor" of application "System Events",
AXTitleUIElement:static text "Untitled 161.scpt" of window
"Untitled 161.scpt" of application process "Script Editor"
of application "System Events", AXCancelButton:missing
value, AXModal:false, AXSubrole:"AXStandardWindow",
AXZoomButton:button 2 of window "Untitled 161.scpt" of
application process "Script Editor" of application "System
Events", AXRoleDescription:"standard window", AXSize:{623,
1095}, AXToolbarButton:missing value,
AXIdentifier:"_NS:794", _AXActions:{"AXRaise"}}