Click a button on floating window using AppleScript

applescript

I'm having issues getting an AppleScript to run for an app called AutoRate. The script below was originally made for version 1.5.5. I've already tried to mess with AppleScript to get it to run on 1.6, but because I've never really used AppleScript before I'm not getting anywhere. The picture shows 1.6 on top and 1.5.5 on the bottom. The 2nd photo shows the hierarchy for 1.6. Any help is appreciated.

tell application "AutoRate"
    activate
    -- Hide app
     tell application "System Events" to key code 4 using {command down}
    -- Press 'begin rating'
     tell button "Begin" of window 2 "main" to perform action
    -- Try to quit afterwards
     quit
end tell

AutoRate 1.5.5 on top. AutoRate 1.6 on bottom

Accessibility Inspector

Best Answer

I just tested this on version 1.6. This code is for clicking the button "Begin Rating"

tell application "AutoRate"
    activate
end tell
delay 2
tell application "System Events"
    click button "Begin Rating" of window "AutoRate" of application process "AutoRate"
end tell

And this code is for clicking the button "Revert Ratings"

tell application "AutoRate"
    activate
end tell
delay 2
tell application "System Events"
    click button "Revert Ratings" of window "AutoRate" of application process "AutoRate"
end tell