Hi,
I have some AppleScript that runs fine but is most likely taking longer than it needs to because I’m stating the same info twice - referencing the same button twice. When I try to simplify the script, I can’t get it to work correctly. I’m trying to set a button “keyboard focused” value to True and then Click the button.
Any help is much appreciated!
Here’s the script that works:
tell application "System Events"
tell process "Logic Pro"
set value of attribute "AXFocused" of button 1 of UI element 1 of (groups whose value of attribute "AXDescription" is "Tracks header") of scroll area 1 of splitter group 2 of splitter group 1 of group 2 of (groups whose value of attribute "AXDescription" contains "Tracks") of group 2 of (first window whose value of attribute "AXTitle" contains " - Tracks") to true
click button 1 of UI element 1 of (groups whose value of attribute "AXDescription" is "Tracks header") of scroll area 1 of splitter group 2 of splitter group 1 of group 2 of (groups whose value of attribute "AXDescription" contains "Tracks") of group 2 of (first window whose value of attribute "AXTitle" contains " - Tracks")
end tell
end tell
Here’s the variation that I can’t get to work:
The error is “Can’t get attribute “AXFocused” of {button 1 of UI element…”
tell application "System Events"
tell process "Logic Pro"
set trackFinal to button 1 of UI element 1 of (groups whose value of attribute "AXDescription" is "Tracks header") of scroll area 1 of splitter group 2 of splitter group 1 of group 2 of (groups whose value of attribute "AXDescription" contains "Tracks") of group 2 of (first window whose value of attribute "AXTitle" contains " - Tracks")
tell trackFinal
set value of attribute "AXFocused" to true
perform action "AXPress"
end tell
end tell
end tell
I have also tried:
This error is “Can’t set «class focu» of {«class butT» 1 of «class uiel» 1 of «class sgrp» 1 of «class scra» 1 of «class splg» 2 of …”
tell application "System Events"
tell process "Logic Pro"
set trackFinal to button 1 of UI element 1 of (groups whose value of attribute "AXDescription" is "Tracks header") of scroll area 1 of splitter group 2 of splitter group 1 of group 2 of (groups whose value of attribute "AXDescription" contains "Tracks") of group 2 of (first window whose value of attribute "AXTitle" contains " - Tracks")
tell trackFinal
set focused to true
perform action "AXPress"
end tell
end tell
end tell