How do I use Applescript to click the Replace button in the Photoshop Save As dialog?

Solution 1:

This works for me on the latest version of High Sierra and Adobe Photoshop CC 2018...

delay 1
tell application "System Events"
    click UI element "Replace" of sheet 1 of window ¬
        "Save As" of application process "Adobe Photoshop CC 2018"
    delay 0.3
    click UI element "Large file size (Fastest saving)" of window ¬
        "PNG Format Options" of application process "Adobe Photoshop CC 2018"
    delay 0.3
    click UI element "OK" of window "PNG Format Options" of ¬
        application process "Adobe Photoshop CC 2018"
end tell

enter image description here