<?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=10481&amp;type=atom" />
	<updated>2015-03-28T18:52:21Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=10481</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Повторение цикла]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=92822#p92822" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>
e::
if (b:= !b)
    SetTimer, Cycle, 1000 ; период повторения – 1 секунда
else
    SetTimer, Cycle, off
return

Cycle:
; тело цикла
send, lal ;пример
return</code></pre></div><div class="codebox"><pre><code>
BlockInput, on ; не реагирует на ввод
/*
код
*/
BlockInput, off ; возвращаем клавиатуре и мишке жизнь</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Eduard]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=28482</uri>
			</author>
			<updated>2015-03-28T18:52:21Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=92822#p92822</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Повторение цикла]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=92788#p92788" />
			<content type="html"><![CDATA[<p>Вот скрипт</p><div class="codebox"><pre><code>key_p:=0 ; В этой переменной хранится количество нажатий кнопки SC012
SC012:: ; SC012 - скан код клавиши [e\у]
loop ; Цикл
{
if (key_p=2) ? !(key_p:=0) : 0 ; Если кнопка нажата 2 раза то, сброс переменной и остановка цикла.
break
% !getkeystate(A_ThisHotkey,&quot;P&quot;) and !key_p ? key_p++ : &quot;&quot; ;Устанавливает значение 1 для key_p, при условии если клавиша отпущена.
;- Ваш скрипт...
Send, n
Sleep, 100
Send, {SPACE}
sleep, 100
Send, i
MouseClick, right,  1775,  666,,0
Sleep, 10
Send, 3
MouseClick, right,  1778, 693,,0
Sleep, 10
Send, i
Sleep, 10
Send, n
Sleep, 10
Send, {SPACE}
;- Ваш скрипт...
}
return
#if (key_p) ; Если нажатий клавиши больше 1 и тд. то скрипт обращается сюда.
SC012::
key_p++ ;И прибавляет +1 к key_p
keywait SC012
return
#if</code></pre></div><p>и вот блокировка курсора<br />вкл\выкл на кнопку windows.<br /></p><div class="codebox"><pre><code>LWIN::
block := block ? 0 : 1
if block
ClipCursor(1,GetCursorPos(0),GetCursorPos(4),GetCursorPos(0),GetCursorPos(4)) 
else
ClipCursor(False)
return
       
       
GetCursorPos(lpPoint)
{ ;https://github.com/jNizM/AHK_DllCall_WinAPI/blob/master/src/Cursor%20Functions/GetCursorPos.ahk
    static POINT, init := VarSetCapacity(POINT, 8, 0) &amp;&amp; NumPut(8, POINT, &quot;Int&quot;)
    if !(DllCall(&quot;user32.dll\GetCursorPos&quot;, &quot;Ptr&quot;, &amp;POINT))
        return DllCall(&quot;kernel32.dll\GetLastError&quot;)
    return NumGet(POINT, lpPoint , &quot;Int&quot;)
}
ClipCursor(Confines := True, Left := 100, Top := 200, Right := 800, Bottom := 900)
{ ; https://github.com/jNizM/AHK_DllCall_WinAPI/blob/master/src/Mouse%20Input%20Functions/ClipCursor.ahk
    if !(Confines)
        return DllCall(&quot;user32.dll\ClipCursor&quot;)
    static RECT, init := VarSetCapacity(RECT, 16, 0)
    NumPut(Left, RECT, 0, &quot;Int&quot;), NumPut(Top, RECT, 4, &quot;Int&quot;), NumPut(Right, RECT, 8, &quot;Int&quot;), NumPut(Bottom, RECT, 12, &quot;Int&quot;)
    if !(DllCall(&quot;user32.dll\ClipCursor&quot;, &quot;Ptr&quot;, &amp;RECT))
        return DllCall(&quot;kernel32.dll\GetLastError&quot;)
    return 1
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[yalanne]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=32850</uri>
			</author>
			<updated>2015-03-27T18:35:52Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=92788#p92788</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Повторение цикла]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=92756#p92756" />
			<content type="html"><![CDATA[<p>Sleep&#039;ы надо заменить на while loop&#039;ы, проверяющие сколько времени прошло (A_Now) и не нажата ли физически (getkeystate) кнопка-токен &quot;е&quot; или что там...</p>]]></content>
			<author>
				<name><![CDATA[Drugoy]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27463</uri>
			</author>
			<updated>2015-03-26T14:09:25Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=92756#p92756</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: Повторение цикла]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=92346#p92346" />
			<content type="html"><![CDATA[<p>Здравствуйте, подскажите пожалуйста, как в этом коде сделать повторение цикла + что бы при повторном нажатии на &quot;Е&quot; повторение прекращалось.</p><div class="codebox"><pre><code>e::
Send, n
Sleep, 100
Send, {SPACE}
sleep, 100
Send, i
MouseClick, right,  1775,  666
Sleep, 10
Send, 3
MouseClick, right,  1778, 693
Sleep, 10
Send, i
Sleep, 10
Send, n
Sleep, 10
Send, {SPACE}
</code></pre></div><br /><p>И еще, есть ли код, что бы мышка при </p><div class="codebox"><pre><code>Send, i
MouseClick, right,  1775,  666
Sleep, 10
Send, 3
MouseClick, right,  1778, 693</code></pre></div><p> игнорировала мои движения ею и мои нажатия на кнопки, а реагировала только на скрипт? Соответственно после включалась обратно.</p><p>Т.е. суть в том что бы когда мышка находится&nbsp; в районе 1775,&nbsp; 666 и&nbsp; 1778, 693&nbsp; грубо говоря замораживалась не была активной с моей стороны, а со стороны скрипта двигалась как обычно.</p><br /><p> Я использую скрипт, но при этом делаю мышкой другие задачи. И&nbsp; когда включатся скрипт (интервал 15 сек) мышка выполняла другие действия, и иногда нарушает работу скрипта. Вот если бы она отключалась на </p><div class="codebox"><pre><code>Sleep, 100</code></pre></div><p> хотя бы, вот тогда все работало.</p>]]></content>
			<author>
				<name><![CDATA[size222]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27237</uri>
			</author>
			<updated>2015-03-07T08:44:20Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=92346#p92346</id>
		</entry>
</feed>
