<?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="http://forum.script-coding.com/extern.php?action=feed&amp;tid=15218&amp;type=atom" />
	<updated>2020-03-03T19:56:59Z</updated>
	<generator>PunBB</generator>
	<id>http://forum.script-coding.com/viewtopic.php?id=15218</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Нажатие левой кнопки мыши - действие, нажатие правой отмена]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=138258#p138258" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>
*XButton1::
	KeyWait := 1
	SetKeyDelay,, 64
	Send {e} 
	While !GetKeyState(&quot;LButton&quot;, &quot;P&quot;) &amp;&amp; KeyWait
		Sleep 20
	If !KeyWait
		Return
	KeyWait := 0
	Send {LButton} 
	Sleep, 500
	Send {e} 
	Return

#If KeyWait
~RButton:: KeyWait := 0
#If
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2020-03-03T19:56:59Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=138258#p138258</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Нажатие левой кнопки мыши - действие, нажатие правой отмена]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=138223#p138223" />
			<content type="html"><![CDATA[<p><strong>stealzy</strong><br />спасибо за пример более оптимального кода, на будущее пригодится )</p><p>единственное что, в таком варианте при попытке отмены игрового действия правой мышью, оно просто перезагружает скрипт, а в игре отмена действия уже не срабатывает</p>]]></content>
			<author>
				<name><![CDATA[noteless]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=40660</uri>
			</author>
			<updated>2020-03-02T18:53:55Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=138223#p138223</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Нажатие левой кнопки мыши - действие, нажатие правой отмена]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=138212#p138212" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>*XButton1::
	SetKeyDelay,, 64
	Send {e}
	KeyWait LButton, D
	; Send {LButton}
	Sleep 500
	Send {e}
Return

~RButton::Reload</code></pre></div>]]></content>
			<author>
				<name><![CDATA[stealzy]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=31937</uri>
			</author>
			<updated>2020-03-02T16:33:22Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=138212#p138212</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Нажатие левой кнопки мыши - действие, нажатие правой отмена]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=138207#p138207" />
			<content type="html"><![CDATA[<p>вроде сообразил )</p><div class="codebox"><pre><code>
*XButton1::
Send {e Down}
Sleep, 64
Send {e Up}
Loop
{
if GetKeyState(&quot;LButton&quot;, &quot;P&quot;)
 {
   Send {LButton Down}
   Sleep, 64
   Send {LButton Up}
   Sleep, 500
   Send {e Down}
   Sleep, 64
   Send {e Up}
   break
 }
if GetKeyState(&quot;RButton&quot;, &quot;P&quot;)
break
}
Return</code></pre></div>]]></content>
			<author>
				<name><![CDATA[noteless]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=40660</uri>
			</author>
			<updated>2020-03-02T12:25:16Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=138207#p138207</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: Нажатие левой кнопки мыши - действие, нажатие правой отмена]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=138206#p138206" />
			<content type="html"><![CDATA[<p>Я не волшебник, я только учусь (с) на примерах.<br />Но подходящий пример не нашел.<br />Скрипт по нажатию кнопки нажимает Е и ждет клика левой мышью, потом отрабатывает остальное.<br />Но если нужно отменить действие (в игре это правая кнопка мыши), то игровое-то действие отменяется, а вот скрипт продолжает ждать нажатие левой кнопки мыши.<br />Как сделать, чтобы при нажатии правой кнопки мыши скрипт возвращался в исходное положение?<br />Предполагаю, что через GetKeyState и If, но все что пробовал не работает, знаний не хватает )</p><div class="codebox"><pre><code>

*XButton1::
Send {e Down}
Sleep, 64
Send {e Up}
KeyWait, LButton, D
Send {LButton Down}
Sleep, 64
Send {LButton Up}
Sleep, 500
Send {e Down}
Sleep, 64
Send {e Up}
Return

</code></pre></div>]]></content>
			<author>
				<name><![CDATA[noteless]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=40660</uri>
			</author>
			<updated>2020-03-02T11:52:56Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=138206#p138206</id>
		</entry>
</feed>
