title: Applescript to click Done when dictating (Mac)
body: <p>I have a script that opens "Dictation &amp; Speech", activates it (turns Dictation: On) and runs a shortcut to start dictating (System Events keystrokes Command D). All this works fine, but what I want to do is for it to click done (or the return key) after speech is not heard. I tried someone's answer from StackOverflow. </p>
  
  <p>Here is the link: <a href="https://stackoverflow.com/questions/6838912/applescript-to-automatically-close-dialog-box-after-input">Applescript to automatically close dialog box after input?</a></p>
  
  <p>But when it's done editing and the return key is pressed, there is no text entered. Maybe the return key is not pressed, and it just quits the dictation?</p>
  
  <p>EDIT: After some research, I found out that the Dictation Window (or tiny Microphone Popup) will close if clicked anywhere except Done. So I am guessing when the Keystroke Return happens, it is on a different window, so I was wondering how would I get the current window/pop-up then click the Done key in it?</p>