Using AppleScript In Adobe Acrobat PRO DC to Reduce File Size
<p>I am trying to use AppleScript to open a PDF in Adobe Acrobat Pro and reduce the file size using the "Reduce File Size" option when saving the file.</p>

<p><a href="https://i.stack.imgur.com/YBs86.png" rel="nofollow noreferrer">Trying to click this element</a></p>

<p>Which, according to Accessibility Inspector, has the following hierarchy: 
<a href="https://i.stack.imgur.com/4PhUv.png" rel="nofollow noreferrer">Accessibility Inspector Image</a></p>

<p>My first step was tracking down all the elements in the window with <code>set allElem to entire contents of window "Save As PDF"</code>. The output suggests this element is not a button or checkbox: </p>

<pre><code>group "Reduce File Size" of group "    My Computer        " of UI element 1 of group 1 of group 1 of window "Save As PDF" of application process "AdobeAcrobat" of application "System Events"

 static text "Reduce File Size" of group 1 of group "Reduce File Size" of group "    My Computer        " of UI element 1 of group 1 of group 1 of window "Save As PDF" of application process "AdobeAcrobat" of application "System Events"        

 text field 1 of static text "Reduce File Size" of group 1 of group "Reduce File Size" of group "    My Computer        " of UI element 1 of group 1 of group 1 of window "Save As PDF" of application process "AdobeAcrobat" of application "System Events"

group 1 of group "Reduce File Size" of group "    My Computer        " of UI element 1 of group 1 of group 1 of window "Save As PDF" of application process "AdobeAcrobat" of application "System Events"
</code></pre>

<p>Without a button to click, I tried getting around the issue by sending keystrokes to the window.  </p>

<pre><code>tell window "Save As PDF"
    activate
    keystroke tab
    keystroke tab
    keystroke tab
    keystroke tab
    delay 1
    key code 36 --return key                            
end tell
</code></pre>

<p>But the window "Save As PDF" does not appear to be coming to the front; therefore, the keystrokes are not registering to that particular window. </p>

<p>Similarly</p>

<pre><code>tell group "Reduce File Size" of group "    My Computer        " of UI element 1 of group 1 of group 1 of window "Save As PDF" of application process "AdobeAcrobat" of application "System Events"
    set {xPosition, yPosition} to position
    set {xSize, ySize} to size
    click at {xPosition + (xSize div 2), yPosition + (ySize div 2)}
end tell
</code></pre>

<p>doesn't work because the click event is not occurring in the "Save As PDF" window for some reason. </p>

<p>So now I'm wondering two things: </p>

<ol>
<li><p>Is there actually a button or checkbox that I can click (am I somehow missing something with the available click events, e.g. can you send a click event to the static text?). </p></li>
<li><p>Why are the keystrokes and click events not registering in the window? </p></li>
</ol>