方針転換して、AppleScriptでUIを叩くことにしてみた。
遠回りな気もするけど……。
tell application "System Preferences"
activate
end tell
tell application "System Events"
if UI elements enabled then
tell process "System Preferences"
tell item 1 of pop up button 1 of tab group 1 of window 3 of application process "System Preferences" of application "System Events"
click
delay 0.2
click menu item "30分" of menu 1
--set item_list to name of every UI element
--get every UI element
end tell
end tell
else
tell application "System Preferences"
activate
set current pane to pane "com.apple.preference.universalaccess"
display dialog "UI element scripting is not enabled."
end tell
end if
end tell
なんせここまで来た。
radio buttonを押すと、window 1→window 3に切り替わるというのがわかってなくて悩んだ。
pop up buttonの押し方も発見した。
ios - Selecting Pop Up Menu Buttons in AppleScript - Stack Overflow
UI Elementを探す(手作業だけど)方法も発見した。
AppleScriptでUI Elementsをリストで取得して使う方法 - Qiita
[AppleScript] UI Elementsをリストとして取得
AppleScriptでモニタの明るさ… - Apple コミュニティ