title: ControlSend Using the Control Text, Rather than Window Text in AHK
body: <p>I'm trying to force a window to close by pressing it's &quot;Cancel&quot; button, but I'm having a hard time using either ControlSend or ControlClick to accomplish this. I know what the control is called via Window Spy, and I know I have my syntax/names correct. I've had problems like this before with this particular program's popup windows not responding well to Controlsend. I could just send a couple of {Tab}'s, but I'd rather be precise about it.</p>
  <p>So, here's my question. Can you use the CONTROL text, rather than the window text to control where a command is sent?</p>
  <p>Here's my current code:</p>
  <pre><code>ControlSend, TmtBitBtn2, {Enter} ahk_class TROListForm
  </code></pre>
  <p>Here's what Window Spy says about this button:</p>
  <p>( Now Under Mouse Cursor )</p>
  <blockquote>
  <p>ClassNN:   TmtBitBtn2</p>
  <p>Text:  Cancel</p>
  <p>Color: 0xF0F0F0  (Blue=F0 Green=F0 Red=F0)</p>
  </blockquote>
  <p>Is there any way I can use the text &quot;Cancel&quot; instead of the ClassNN?</p>
  <p>Thanks!
  Paul</p>