我正在尝试使用 AppleScript 单击选择框中的项目。
当用鼠标手动单击“更多...”项目时,会打开一个标准的 OSX 文件选择器对话框,但是当我尝试使用 AppleScript 执行此操作时,“更多...”项目显示为所选项目框,但没有显示对话框。
到目前为止我已经尝试过......(元素名称来自 Automator 记录器)
tell application "System Events"
click static text 1 of window 1 of application process "DYMO Word Addin"
-- combo box arrow
click UI Element 1 of combo box 2 of group 1 of window 1 of application process "DYMO Word Addin"
set labelsList to (list 1 of scroll area 1 of combo box 2 of group 1 of window 1 of application process "DYMO Word Addin")
set numLabelsInList to (count text fields of labelsList)
set theTextField to (text field numLabelsInList of labelsList)
if numLabelsInList > 1 then
repeat with z from 1 to (numLabelsInList - 1)
key code 125 -- down arrow
end repeat
end if
-- stuff I've tried
click theTextField
keystroke return
key code 36 -- return
set focused of theTextField to true
set value of attribute "AXFocused" of theTextField to true
perform action "AXConfirm" of theTextField
end tell
...现在我没有想法了。