2

Image of my accessibility inspector

I am writing a script that will run a microsoft office installation DMG and click continue and so on and on until the program is installed. I have been successful in navigating the buttons I need to press until I reached the Agree button. Accessibility Inspector says " (sheet) [NSPanel]" when I click on this button. How can I refer to this object? is it possible at all?

tell application "Finder"
    set myFolder to container of (path to me) as alias
end tell

tell application "Finder"
    open document file "Microsoft_Office_16.16.19021001_Installer.pkg" of myFolder
end tell
if application "Installer" is running then
    tell application "Installer"
        activate
    end tell
    tell application "System Events"
        tell process "Installer"
            click button "Continue" of window "Install Microsoft Office for Mac"
            click button "Continue" of window "Install Microsoft Office for Mac"
            click button "Agree" outline "" of window "Install Microsoft Office for Mac"
        end tell
    end tell
end if  

Image of my accessibility inspector

haibert
  • 111
  • 5
  • 1
    You can also use indexes, for example `button 1 of sheet 1 of window 1`. – red_menace Mar 21 '20 at 21:30
  • It would help if you showed the accessibility inspector for the sheet itself, rather than for the button that's three levels down the hierarchy. Regardless, System Events has an object called 'Sheet', so you can try referencing that: `sheet 1 of button "Agree"`. If worse comes to worst, you can use the generic `UI element`: `UI element 1 of button "Agree"`, though you may have to play with the index, since a button will contain other UI elements (like the text filed for it's label). – Ted Wrigley Mar 22 '20 at 17:09
  • Thank you for the tips! I actually used the following command to get the correct object name and syntax. """ tell application "System Events" tell front window of application process "SecurityAgent" set uiElems to entire contents end tell end tell ''' – haibert Mar 22 '20 at 20:56

0 Answers0