<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: Loop залип*]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=14138&amp;type=atom" />
	<updated>2018-09-16T08:32:44Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=14138</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Loop залип*]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=128714#p128714" />
			<content type="html"><![CDATA[<p><strong>slavafedora</strong>, почитайте тут (<a href="http://www.script-coding.com/AutoHotkey/Hotkeys.html">Rus</a>/<a href="https://autohotkey.com/docs_1.0/Hotkeys.htm">Eng</a>).</p>]]></content>
			<author>
				<name><![CDATA[Gutalin]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=39002</uri>
			</author>
			<updated>2018-09-16T08:32:44Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=128714#p128714</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Loop залип*]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=128709#p128709" />
			<content type="html"><![CDATA[<p>Для чего нужна звёздочка перед биндом? <br />Что она выполняет? Не встречал раньше.<br /></p><div class="codebox"><pre><code>
*~vk01::
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[slavafedora]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=34221</uri>
			</author>
			<updated>2018-09-16T05:39:54Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=128709#p128709</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Loop залип*]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=128524#p128524" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>romzes96 пишет:</cite><blockquote><p>MouseClickDrag</p></blockquote></div><p>Хрен редьки не слаще, Send / мышиным командам приходится отжимать зажатый вами LButton, который вы непонятно вообще с какой целью посылаете насквозь.<br />Либо не отправляйте нажатие самого хоткея насквозь, либо используйте аналоги мышиных команд через Send с опцией {Blind}.</p>]]></content>
			<author>
				<name><![CDATA[stealzy]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=31937</uri>
			</author>
			<updated>2018-09-06T15:46:00Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=128524#p128524</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Loop залип*]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=128519#p128519" />
			<content type="html"><![CDATA[<p><strong>stealzy</strong> на вряд ли в этом проблема так как имеется еще 1 код а точнее еще одна часть 1-ого кода где тоже происходит &quot;залипание loop&quot;, но там бинд сам себя не отправляет. В общем вот как это выглядит вместе:</p><div class="codebox"><pre><code>#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
#UseHook
#NoEnv
#Persistent
#KeyHistory, 0
#HotKeyInterval -1
#MaxHotkeysPerInterval 200
#InstallKeybdHook
#SingleInstance, Force
SetKeyDelay,  -1
SetMouseDelay, -1

#InstallMouseHook
SetBatchLines, -1
SetTimer, CheckKey, On
SetTimer, CheckKey, 1

x1 := A_ScreenWidth // 100
y1 := A_ScreenHeight // 50
x2 := A_ScreenWidth // 2
y2 := A_ScreenHeight // 4

#If WinActive(&quot;ahk_class xxx&quot;)

*~MButton::
Send, {scF}
Sleep, 10 ; Задержка
Loop ; Цикл
{
	Sleep, 1
	MouseClickDrag, Left, %x1%, %y1%, %x2%, %y2% , 0 ; Передвижение мыши
	GetKeyState, state, MButton, P
	if state = U  ; Клавиша отпущена, поэтому выйти из цикла.
		break
}
Send, {scF} ; Закрыть инвентарь
KeyWait MButton
return


vk5B &amp; vk52::return

vk5B::return

~F6::Suspend

*~End::ExitApp

CheckKey:
GetKeyState, state, LButton 
GetKeyState, state, MButton
Return


*~LButton::
Loop ; Цикл
{
	Sleep, 5
	Send, {LButton}
	moveAmount := (moveAmount = 2) ? 3 : 0
	mouseXY(moveAmount,4.7)
	GetKeyState, state, LButton, P
	if state = U  ; Клавиша отпущена, поэтому выйти из цикла.
		break
}
mouseXY(x,y)
{
	DllCall(&quot;mouse_event&quot;,int,1,int,x,int,y,uint,0,uint,0)
}
; _____________________________________________

KeyWait, LButton
Return
; _____________________________________________

*~XButton2::
Send, 2
Send, 1
Return

*XButton1::
Send, {LButton Down}
KeyWait, XButton1
Send, {LButton Up}
KeyWait, XButton1
Return</code></pre></div><p>Оба лупа <strong>ИНОГДА</strong> зацикливаются. Хотя бинд уже отжат. И циклы не останавливаются пока бинд не будет повторно нажат.<br />SetTimer вообще не как не повлиял на код, даже если его значение равно 1.<br />Не могу понять в чем проблема.</p>]]></content>
			<author>
				<name><![CDATA[romzes96]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=38749</uri>
			</author>
			<updated>2018-09-06T08:01:29Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=128519#p128519</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Loop залип*]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=128498#p128498" />
			<content type="html"><![CDATA[<p>Используйте цикл While вместо Loop.</p>]]></content>
			<author>
				<name><![CDATA[powercat]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=37884</uri>
			</author>
			<updated>2018-09-05T14:46:02Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=128498#p128498</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: Loop залип*]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=128487#p128487" />
			<content type="html"><![CDATA[<p>Здравствуйте, не подскажите в чем может быть проблема(?)<br />Есть вроде бы простой скрипт:</p><div class="codebox"><pre><code>#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
#UseHook
#NoEnv
#Persistent
#KeyHistory, 0
#HotKeyInterval -1
#MaxHotkeysPerInterval 200
#InstallKeybdHook
#SingleInstance, Force
SetKeyDelay,  -1
SetMouseDelay, -1

#InstallMouseHook
SetBatchLines, -1
SetTimer, CheckKey, On
SetTimer, CheckKey, 1

*~LButton::
Loop ; Цикл
{
	Sleep, 5
	Send, {LButton}
	moveAmount := (moveAmount = 2) ? 3 : 0
	mouseXY(moveAmount,4.7)
	GetKeyState, state, LButton, P
	if state = U  ; Клавиша отпущена, поэтому выйти из цикла.
		break
}
mouseXY(x,y)
{
	DllCall(&quot;mouse_event&quot;,int,1,int,x,int,y,uint,0,uint,0)
}

KeyWait, LButton
Return</code></pre></div><p>Беда в том что при нажатие LButton <strong>ИНОГДА</strong> скрипт не выходит из циклы и думает что LButton до сих пор в статусе &quot;Нажата&quot;. Хотя кнопка мыши уже давно отпущена. </p><p>Есть еще один код написанный за долго до первого и в нем данной проблемы вроде бы нет. Вот он:</p><div class="codebox"><pre><code>#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

#NoEnv
SendMode Input

~F5::Suspend

~End::ExitApp

*~LButton::
Loop ; Цикл
{
	Sleep, 5
	moveAmount := (moveAmount = 2) ? 3 : 0
	mouseXY(moveAmount,4.5)
	GetKeyState, state, LButton, P
	if state = U  ; Клавиша отпущена, поэтому выйти из цикла.
		break
}
mouseXY(x,y)
{
	DllCall(&quot;mouse_event&quot;,int,1,int,x,int,y,uint,0,uint,0)
}</code></pre></div><p>Структура вроде одна, но <strong>второй/это</strong>т скрипт не залипает в цикле...</p><p>В первом коде SetTimer не помог решить данную проблему. Не подскажите может быть в первом коде что-то лишнее имеется(?)<br />Спасибо!</p>]]></content>
			<author>
				<name><![CDATA[romzes96]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=38749</uri>
			</author>
			<updated>2018-09-05T09:25:36Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=128487#p128487</id>
		</entry>
</feed>
