title: How to obtain textual contents from a window
body: <p>I have a window that displays a book. In two smaller boxes below, there is page number and volume information of the book that is open. I can get that information easily as follows:</p>
  
  <pre><code>ControlGetText, volume, ThunderRT6TextBox3      
  ControlGetText, page, ThunderRT6TextBox2
  </code></pre>
  
  <p>Then my script makes my mouse pointer move to a button. It clicks it, and a new window pops open. In that window, there is more textual information related to the book, such as publisher, name author, edition etc. I want to retrieve that information. But when I try the same strategy it is not working, eg:</p>
  
  <p><code>ControlGetText, data, RichTextWndClass3</code></p>
  
  <p>The only difference between the two cases, is that those two small boxes are editable, you can enter text whereas this window is static.</p>
  
  <p>I tried many other options such as:
  <code>SendEvent ^a</code>
  Which is equivalent to control + a, which should select everything. I tried putting pauses but it would never select. I tried the script to manually double click on that window. It works, and one word gets select like that. Even then SendEvent ^a doesn't do anything.
  However, if I do SendEvent ^{insert}, then the selected word gets copied to my clipboard.</p>
  
  <p>I experimented with more combinations:</p>
  
  <pre><code>ControlSend ahk_class ThunderRT6FormDC, ^a
  ControlSend ClassNN RichTextWndClass3, ^a
  </code></pre>
  
  <p>and</p>
  
  <pre><code>ControlSend ThunderRT6FormDC, ^a
  ControlSend RichTextWndClass3, ^a
  </code></pre>
  
  <p>None of them work. All text selection does not manifest itself in that window.</p>
  
  <p>The only alternative remaining for me is to make the script do a manual selection of the entire text. However, this is slow and very ridiculous. Moreover, in Window Spy under the section: Visible Window Text, the text is all there. I tried many other possibilities and I am at the end of my wits. How am I to harvest that text directly?</p>
  
  <hr>
  
  <p>EDIT--
  The text of the window shows in Window Spy under the heading: TitleMatchMode=slow Visible Text, NOT the heading: Visible Window Text</p>
  
  <hr>
  
  <p>EDIT--
  I spoke to you about two windows. The first one in which i get volume and page number. The second one which needs to pop up by pressing a button.
  Both these windows have the same class-name:
  ahk_class ThunderRT6MDIForm
  Is that problematic in any way?</p>
  
  <hr>
  
  <p>EDIT--
  The conclusion is that it is impossible for me to get that text from the second window directly. As such, I opted for the lame, boring manual method. I send out a {shift down} to the active window and then do a click at the bottom of the window. Then I save the selection to my clipboard. It works, but it is just stupid. Please help me find a more elegant solution than this one.</p>
  
  <p>This is the code I used:</p>
  
  <pre><code>ControlGetText, volume, ThunderRT6TextBox3 
  
  ControlGetText, page, ThunderRT6TextBox2 
  
  Click, 110, 70 
  
  sleep 1000
  
  SendInput {shift down}
  
  click 29, 490
  
  SendInput {shift up}
  
  sleep 1000
  
  SendInput, ^{ins} 
  
  sleep 100
  </code></pre>
  
  <p>It is funny to note that real keyboard keys, such as a b c are not possible. But I am able to send a ctrl, shift and an ins. As I noted above, ^c was also giving issues just like ^a was giving issues.</p>