<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: Чтение текста из контролов всех окон]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=6485&amp;type=atom" />
	<updated>2011-11-29T17:05:22Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=6485</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Чтение текста из контролов всех окон]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=54019#p54019" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Tatrin пишет:</cite><blockquote><p>Извините за невнимательность. Попробовал в работе этот скрипт на примере запущенного блокнота. Выводится класс и название блокнота, но текст который в нем записан не отображается. Не подскажите как его прочитать?</p></blockquote></div><p>Нужно &quot;WinGetText WindowText, ahk_id %cur%&quot; заменить на &quot;ControlGetText WindowText,, ahk_id %cur%&quot;. Но в общем случае нужно проверить, является ли окно контролом(свойство WS_CHILD) и вызвать соответствующую функцию.</p>]]></content>
			<author>
				<name><![CDATA[Александр_]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24888</uri>
			</author>
			<updated>2011-11-29T17:05:22Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=54019#p54019</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Чтение текста из контролов всех окон]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=54012#p54012" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Tatrin пишет:</cite><blockquote><p>Выводится класс и название блокнота, но текст который в нем записан не отображается. ...как его прочитать?</p></blockquote></div><div class="codebox"><pre><code>Gui, Add, Edit, vControlText x12 y10 w450 h350
Gui, -MaximizeBox
Gui, Show, Center w474 h372, Test
ControlGetText, CText, Edit1, ahk_class Notepad ; Edit1 - название контрола содержащего текст
GuiControl,, ControlText, % CText ? CText:&quot;Блокнот не запущен, или не имеет текста!&quot;
Return

GuiClose:
   ExitApp

F5::Reload
Esc::ExitApp</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Grey]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=25792</uri>
			</author>
			<updated>2011-11-29T12:45:51Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=54012#p54012</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Чтение текста из контролов всех окон]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=53982#p53982" />
			<content type="html"><![CDATA[<p>Извините за невнимательность. Попробовал в работе этот скрипт на примере запущенного блокнота. Выводится класс и название блокнота, но текст который в нем записан не отображается. Не подскажите как его прочитать?</p>]]></content>
			<author>
				<name><![CDATA[Tatrin]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27382</uri>
			</author>
			<updated>2011-11-28T15:47:29Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=53982#p53982</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Чтение текста из контролов всех окон]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=53884#p53884" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Tatrin пишет:</cite><blockquote><p>В этом примере в файл записывается вся информация со всех окон</p></blockquote></div><p>О_о<br />В этом примере записываются только имя класса и текст из всех окон указанного процесса.</p>]]></content>
			<author>
				<name><![CDATA[Александр_]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24888</uri>
			</author>
			<updated>2011-11-26T15:04:03Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=53884#p53884</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Чтение текста из контролов всех окон]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=53882#p53882" />
			<content type="html"><![CDATA[<p>В этом примере в файл записывается вся информация со всех окон, а мне нужен текст только окна указанного процесса. Извините если чего-то не понимаю, я в AHK новичок. Как я понимаю нужно добавить проверку на PID для каждого полученного окна, или для каждого окна надо еще применять функцию ControlGetText?</p>]]></content>
			<author>
				<name><![CDATA[Tatrin]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27382</uri>
			</author>
			<updated>2011-11-26T13:18:03Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=53882#p53882</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Чтение текста из контролов всех окон]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=53854#p53854" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Tatrin пишет:</cite><blockquote><p>Вот что мне нужно сделать:<br />приходит id процесса, мне нужно найти окно которое соответствует этому процессу и вытянуть из него весь текст включая текст контролов и записывать их в текстовый документ.<br />...<br />Может кто подсказать как это сделать?</p></blockquote></div><p>так?<br /></p><div class="codebox"><pre><code>FindWindowEx(hwndParent, hwndChildAfter, ClassName, WindowName)
{
   return DllCall(&quot;FindWindowEx&quot;, &quot;uint&quot;, hwndParent, &quot;uint&quot;, hwndChildAfter, &quot;uint&quot;, ClassName, &quot;uint&quot;, WindowName, &quot;uint&quot;)
}
EnumChild(hwndParent, byref str, byref prestr)
{
   cur:=FindWindowEx(hwndParent, 0, 0, 0)
   if (cur=0)
   {
      return
   }
   str:=str . prestr . &quot;{`n&quot;
   prestr:=prestr . &quot;   &quot;
   while (cur&lt;&gt;0)
   {
      WinGetClass ClassName, ahk_id %cur%
	  WinGetText WindowText, ahk_id %cur%
	  WindowText := RegExReplace(WindowText, &quot;\r\n|\n|\r&quot;, &quot;\n&quot;)
	  str:=str . prestr . &quot;ClassName &#039;&quot; . ClassName . &quot;&#039;, WindowName &#039;&quot; . WindowText . &quot;&#039;`n&quot;
	  EnumChild(cur, str, prestr)
      cur:=FindWindowEx(hwndParent, cur, 0, 0)
   }
   prestr:=SubStr(prestr, 1 , StrLen(prestr)-3)
   str:=str . prestr . &quot;}`n&quot;
}

DetectHiddenWindows on
DetectHiddenText on
pid:=4848 ; идентификатор нужного процесса
WinGet id, list, ahk_pid %pid%
str:=&quot;&quot; ; строка для записи в файл
prestr:=&quot;&quot; ; пробелы для читабельности
Loop, %id%
{
    this_id := id%A_Index%
	WinGetClass, ClassName, ahk_id %this_id%
	WinGetTitle, WindowName, ahk_id %this_id%
	str:=str . &quot;ClassName &#039;&quot; . ClassName . &quot;&#039;, WindowName &#039;&quot; . WindowName . &quot;&#039;`n&quot;
	EnumChild(id%A_Index%, str, prestr)
}
FileDelete %a_scriptdir%\1.txt 
FileAppend %str%, %a_scriptdir%\1.txt</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Александр_]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24888</uri>
			</author>
			<updated>2011-11-25T17:16:54Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=53854#p53854</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Чтение текста из контролов всех окон]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=53851#p53851" />
			<content type="html"><![CDATA[<p><span style="color: green"><strong>Tatrin</strong>, прочитайте первую тему в этом разделе. Затем исправьте заголовок темы, отредактировав первое сообщение. Оформите код правильно.</span></p>]]></content>
			<author>
				<name><![CDATA[ypppu]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=5974</uri>
			</author>
			<updated>2011-11-25T15:48:13Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=53851#p53851</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: Чтение текста из контролов всех окон]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=53849#p53849" />
			<content type="html"><![CDATA[<p>Вот что мне нужно сделать:<br />приходит id процесса, мне нужно найти окно которое соответствует этому процессу и вытянуть из него весь текст включая текст контролов и записывать их в текстовый документ.</p><p>на данном этапе дошел до следующего скрипта:<br /></p><div class="codebox"><pre><code>DetectHiddenWindows,on
DetectHiddenText, on
WinGet, id, list,,, Program Manager
Loop, %id%
{
    this_id := id%A_Index%
    WinActivate, ahk_id %this_id%
    WinGet, ControlList, ControlList,A
    WinGetText,  this_text,  ahk_id %this_id%
 ;   ControlGet, List, List, Selected, SysListView321, WinTitle
    FileAppend, %this_text% `n, D:\1.txt
}</code></pre></div><p>Может кто подсказать как это сделать?</p>]]></content>
			<author>
				<name><![CDATA[Tatrin]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27382</uri>
			</author>
			<updated>2011-11-25T15:20:13Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=53849#p53849</id>
		</entry>
</feed>
