<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: ListLines в реальном времени]]></title>
	<link rel="self" href="http://forum.script-coding.com/extern.php?action=feed&amp;tid=15655&amp;type=atom" />
	<updated>2020-09-17T22:14:22Z</updated>
	<generator>PunBB</generator>
	<id>http://forum.script-coding.com/viewtopic.php?id=15655</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: ListLines в реальном времени]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=142180#p142180" />
			<content type="html"><![CDATA[<p><strong>Botsy</strong></p><p>Как вариант - написать Gui окошко и выводить текст в него.</p>]]></content>
			<author>
				<name><![CDATA[__Михаил__]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=40928</uri>
			</author>
			<updated>2020-09-17T22:14:22Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=142180#p142180</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: ListLines в реальном времени]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=142164#p142164" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>__Михаил__ пишет:</cite><blockquote><p><strong>Botsy</strong></p><p>Можно установить как запуск по клавише, затем когда нужно отследить, что делает скрипт - нажать эту клавишу и начнётся отображение истории.</p></blockquote></div><p>Спасибо, разобрался. А можно сделать вывод не поверх всех окон ? <br /></p><div class="codebox"><pre><code>
ListLinesOutput(Text) { 
	ToolTip % LastLines(Text, 66), 0, 0, 2
}
</code></pre></div><p>Вроде надо этот tooltip заменить, только на что ?</p>]]></content>
			<author>
				<name><![CDATA[Botsy]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=41069</uri>
			</author>
			<updated>2020-09-17T06:54:32Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=142164#p142164</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: ListLines в реальном времени]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=142129#p142129" />
			<content type="html"><![CDATA[<p><strong>Botsy</strong></p><p>Можно установить как запуск по клавише, затем когда нужно отследить, что делает скрипт - нажать эту клавишу и начнётся отображение истории.</p>]]></content>
			<author>
				<name><![CDATA[__Михаил__]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=40928</uri>
			</author>
			<updated>2020-09-14T15:18:28Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=142129#p142129</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: ListLines в реальном времени]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=142127#p142127" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>serzh82saratov пишет:</cite><blockquote><p>Выводит последние 66 строк.</p></blockquote></div><p> Спасибо за ответ, правда я так и не разобрался как это работает и как это применить.</p>]]></content>
			<author>
				<name><![CDATA[Botsy]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=41069</uri>
			</author>
			<updated>2020-09-14T12:52:08Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=142127#p142127</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: ListLines в реальном времени]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=142055#p142055" />
			<content type="html"><![CDATA[<p>Выводит последние 66 строк.<br /></p><div class="codebox"><pre><code>
SetTimer, ListLines, 333

loop
{
	If !Mod(A_Index, 4)
		Sleep 1
	Sleep 111
} 

ListLinesOutput(Text) { 
	ToolTip % LastLines(Text, 66), 0, 0, 2
}

LastLines(Haystack, Lines) { 
	If (1, StrReplace(Haystack, &quot;`n&quot;, , c)) &amp;&amp; (r := c - Lines + 1) &gt; 0
		Haystack := SubStr(Haystack, InStr(Haystack, &quot;`n&quot;, , , r) + 1)
	Return Haystack
}

ListLines() {
	Static hwndEdit, pSFW, pSW, bkpSFW, bkpSW
	ListLines Off
	
	if !hwndEdit
	{
		; Retrieve the handle of our main window&#039;s Edit control:
		dhw := A_DetectHiddenWindows
		DetectHiddenWindows, On
		Process, Exist
		ControlGet, hwndEdit, Hwnd,, Edit1, ahk_class AutoHotkey ahk_pid %ErrorLevel%
		DetectHiddenWindows, %dhw%
		
		astr := A_IsUnicode ? &quot;astr&quot; : &quot;str&quot;
		hmod := DllCall(&quot;GetModuleHandle&quot;, &quot;str&quot;, &quot;user32.dll&quot;)
		; Get addresses of these two functions:
		pSFW := DllCall(&quot;GetProcAddress&quot;, &quot;uint&quot;, hmod, astr, &quot;SetForegroundWindow&quot;)
		pSW := DllCall(&quot;GetProcAddress&quot;, &quot;uint&quot;, hmod, astr, &quot;ShowWindow&quot;)
		; Make them writable:
		DllCall(&quot;VirtualProtect&quot;, &quot;uint&quot;, pSFW, &quot;uint&quot;, 8, &quot;uint&quot;, 0x40, &quot;uint*&quot;, 0)
		DllCall(&quot;VirtualProtect&quot;, &quot;uint&quot;, pSW, &quot;uint&quot;, 8, &quot;uint&quot;, 0x40, &quot;uint*&quot;, 0)
		; Save initial values of the first 8 bytes:
		bkpSFW := NumGet(pSFW+0, 0, &quot;int64&quot;)
		bkpSW := NumGet(pSW+0, 0, &quot;int64&quot;)
	}
	
	; Overwrite SetForegroundWindow() and ShowWindow() temporarily:
	NumPut(0x0004C200000001B8, pSFW+0, 0, &quot;int64&quot;)  ; return TRUE
	NumPut(0x0008C200000001B8, pSW+0, 0, &quot;int64&quot;)   ; return TRUE
	
	; Dump ListLines into hidden AutoHotkey main window:
	ListLines
	
	; Restore SetForegroundWindow() and ShowWindow():
	NumPut(bkpSFW, pSFW+0, 0, &quot;int64&quot;)
	NumPut(bkpSW, pSW+0, 0, &quot;int64&quot;)
	
	; Retrieve ListLines text and strip out some unnecessary stuff:
	ControlGetText, ListLinesText,, ahk_id %hwndEdit%
	RegExMatch(ListLinesText, &quot;.*`r`n`r`n\K[\s\S]*(?=`r`n`r`n.*$)&quot;, ListLinesText)
	StringReplace, ListLinesText, ListLinesText, `r`n, `n, All
	ListLinesOutput(ListLinesText)
	; ListLines On
	; return ListLinesText  ; This line appears in ListLines if we&#039;re called more than once.
}
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2020-09-09T07:20:49Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=142055#p142055</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: ListLines в реальном времени]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=142053#p142053" />
			<content type="html"><![CDATA[<p>Проще всего запустить второй скрипт, который будет за Вас нажимать F5.</p>]]></content>
			<author>
				<name><![CDATA[ypppu]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=5974</uri>
			</author>
			<updated>2020-09-09T04:00:03Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=142053#p142053</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: ListLines в реальном времени]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=142051#p142051" />
			<content type="html"><![CDATA[<p>Добрый день. Подскажите, есть ли возможность в консоли или где нибудь еще, отображать выполнение скрипта в реальном времени ? Например если добавить команду ListLines, то там будет отображаться выполненные команды на момент открытия, а для дальнейшего отображения надо всегда нажимать &quot;обновить&quot; F5. <br />Или может есть другие способы посмотреть на выполнение скрипта ? Если я правильно разобрался, то дебагинг в notepad, ahk studio и SciTE4AutoHotkey не подходит, т.к. он делает команду за командой в ручном режиме (надо нажимать все время &quot;след. шаг&quot;).</p>]]></content>
			<author>
				<name><![CDATA[Botsy]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=41069</uri>
			</author>
			<updated>2020-09-09T00:50:09Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=142051#p142051</id>
		</entry>
</feed>
