<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; Проблемы с запуском скрипта при использовании PressCount]]></title>
	<link rel="self" href="http://forum.script-coding.com/extern.php?action=feed&amp;tid=12305&amp;type=atom" />
	<updated>2017-01-13T05:44:58Z</updated>
	<generator>PunBB</generator>
	<id>http://forum.script-coding.com/viewtopic.php?id=12305</id>
		<entry>
			<title type="html"><![CDATA[Re: Проблемы с запуском скрипта при использовании PressCount]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=110950#p110950" />
			<content type="html"><![CDATA[<p><strong>YMP</strong><br />Ещё раз большое спасибо</p>]]></content>
			<author>
				<name><![CDATA[ascaria]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=34473</uri>
			</author>
			<updated>2017-01-13T05:44:58Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=110950#p110950</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Проблемы с запуском скрипта при использовании PressCount]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=110949#p110949" />
			<content type="html"><![CDATA[<p>Так это оно и есть, просто вы окольным путём пошли. Можно было просто добавить Suspend к определению хоткея.<br /></p><div class="codebox"><pre><code>
t::
    Suspend, Off
    Gosub, PressCount
    Return
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[YMP]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=81</uri>
			</author>
			<updated>2017-01-13T03:56:57Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=110949#p110949</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Проблемы с запуском скрипта при использовании PressCount]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=110934#p110934" />
			<content type="html"><![CDATA[<p><strong>YMP</strong><br />Большое спасибо за подсказку, но проблему решила команда Hotkey, $t, MyLabel с дальнейшей записью MyLabel: Suspend, Off перед основным телом скрипта.<br /></p><div class="codebox"><pre><code>
#IfWinActive, test2.ahk — Блокнот
#noenv
Hotkey, $t, MyLabel

F10:: Suspend
F8:: Reload

setbatchlines -1
setkeydelay -1

MyLabel:
Suspend, Off

#UseHook, On

t:: Gosub, PressCount

t(1):
	SendInput {w 2}{e}{r}{e 3}
	Sleep 150
	SendInput {Alt Down}{d}{Alt Up}
Return

t(2):
	SendInput {w 2}{q}{r}{e 3}
	Sleep 150
	Send {Alt Down}{d}{Alt Up}
Return

#UseHook, Off

PressCount:
  Pause_=200

  If not Second
  {
    Second=1
    SetTimer, DoublePress, -%Pause_%
  }
  Else
  {
    Second=0
    SetTimer, %A_ThisHotkey%(2), -1
  }
Return

DoublePress:
  If not Second
  Return
  Second=0
  SetTimer, %A_ThisHotkey%(1), -1
Return

$6::
	Send {q 2}{w}{r}{w 3}
	Sleep 150
	Send {d 3}
	Suspend, On
Return
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[ascaria]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=34473</uri>
			</author>
			<updated>2017-01-12T23:05:05Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=110934#p110934</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Проблемы с запуском скрипта при использовании PressCount]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=110876#p110876" />
			<content type="html"><![CDATA[<p>Проблема, видимо, в том, что нажатие t у вас в одном месте, а команда Suspend, Off в другом. При том, что в режиме Suspend АНК выполняет только те горячие клавиши, которые имеют непосредственно возле себя команду Suspend. А у вас непосредственно к t привязана только команда Gosub, PressCount.</p>]]></content>
			<author>
				<name><![CDATA[YMP]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=81</uri>
			</author>
			<updated>2017-01-12T12:26:12Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=110876#p110876</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Проблемы с запуском скрипта при использовании PressCount]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=110873#p110873" />
			<content type="html"><![CDATA[<p>Добрый день.<br />Работа скрипта заключается в том, что если пользователь нажимает на &quot;6&quot;, происходит последовательное нажатие клавиш и остановка скрипта. При нажатии на &quot;t&quot; скрипт должен снова включиться и эмулировать нажатия другой последовательности клавиш.<br />Проблемы начинаются, когда я пытаюсь вновь запустить скрипт через &quot;t&quot; - он не запускается, он работает только через &quot;F10&quot;, посему можно предположить, что причина в счетчике нажатий. Либо я ставлю условие запуска не туда, либо сам счетчик написан не совсем верно. Прошу помочь разобраться.</p><p>Рабочая версия скрипта без использования PressCount:<br /></p><div class="codebox"><pre><code>
#noenv
#IfWinActive, test.ahk — Блокнот

setbatchlines -1
setkeydelay -1

F10::Suspend
F8::Reload
Return

$t::
Suspend, Off
	Send {w 2}{e}{r}
	sleep 150
	Send {Alt Down}{d}{Alt Up}{e 3}
Return

$6::
	Loop {
		if not GetKeyState(&quot;6&quot;,&quot;P&quot;)
		Break
		Send {d 2}{e 2}{r}{g 3}
		Sleep 80
	}
Suspend, On
Return
</code></pre></div><p>Сам скрипт:<br /></p><div class="codebox"><pre><code>
#noenv
#IfWinActive, test2.ahk — Блокнот

F10::Suspend
F8::Reload
Return

setbatchlines -1
setkeydelay -1

$6::
	Send {q 2}{w}{r}{w 3}
	Sleep 150
	Send {d 3}
	Suspend, On
Return

#UseHook, On

t:: Gosub, PressCount

t(1):
	Suspend, Off
	Send {w 2}{e}{r}{e 3}
	Sleep 150
	Send {Alt Down}{d}{Alt Up}
Return

t(2):
	Suspend, Off
	Send {w 2}{q}{r}{e 3}
	Sleep 150
	Send {Alt Down}{d}{Alt Up}
Return

#UseHook, Off

PressCount:
  Pause_=200

  If not Second
  {
    Second=1
    SetTimer, DoublePress, -%Pause_%
  }
  Else
  {
    Second=0
    SetTimer, %A_ThisHotkey%(2), -1
  }
Return

DoublePress:
  If not Second
  Return
  Second=0
  SetTimer, %A_ThisHotkey%(1), -1
Return
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[ascaria]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=34473</uri>
			</author>
			<updated>2017-01-12T10:48:18Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=110873#p110873</id>
		</entry>
</feed>
