<?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=17637&amp;type=atom" />
	<updated>2023-03-19T19:02:02Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=17637</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Замена буквы при двойном нажатии горячей клавиши]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=157288#p157288" />
			<content type="html"><![CDATA[<p><strong>serzh82saratov</strong>, этот скрипт вроде полноценно работает как и описано в первом сообщении темы. Благодарю. Попробую в использовать и протестирую более детально.</p><p>Объекты можно записать так:<br /></p><div class="codebox"><pre><code>Chars := 
(Join QC
{
	&quot;#и&quot;:&quot;i&quot;, ; Comment
	&quot;#И&quot;:&quot;I&quot;
}
),

Keys := 
(Join Q
{
	&quot;#и&quot;:&quot;sc30&quot;,
	&quot;#И&quot;:&quot;sc30&quot;
}
)</code></pre></div>]]></content>
			<author>
				<name><![CDATA[avens]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24487</uri>
			</author>
			<updated>2023-03-19T19:02:02Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=157288#p157288</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Замена буквы при двойном нажатии горячей клавиши]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=157232#p157232" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>avens пишет:</cite><blockquote><p>Плюс эта функция не работает:</p></blockquote></div><p>Так попробуйте.<br /></p><div class="codebox"><pre><code>ih := InputHook(&quot;V L0&quot;)
ih.OnChar := Func(&quot;OnChar&quot;)
ih.Start()
Return

OnChar(InputHook, Char) {  
	Critical 
	Static PrChar, PrTime, PrTime2
	, Chars := {&quot;#и&quot;:&quot;i&quot;,&quot;#И&quot;:&quot;I&quot;} 
	, Keys := {&quot;#и&quot;:&quot;sc30&quot;,&quot;#И&quot;:&quot;sc30&quot;} 
	If !Chars[&quot;#&quot; Char]
		Return PrTime2 := 0
	InputHook.Stop()
	Key := GetKeySC(Char) ? Format(&quot;sc{:x}&quot;, GetKeySC(Char)) : Keys[&quot;#&quot; Char]
	KeyWait % Key, T0.25
	If ErrorLevel
	{
		KeyWait % Key
		PrTime := 0 
		Return InputHook.Start()
	}
	If (PrChar == Char &amp;&amp; A_TickCount - PrTime &lt; 250)
	{
		SendInput % &quot;{Backspace &quot; 1 + (A_TickCount - PrTime2 &gt; 250) &quot;}&quot;
		SendInput % &quot;{Text}&quot; Chars[&quot;#&quot; Char]
		PrTime2 := A_TickCount
	}  
	PrChar := Char, PrTime := A_TickCount
	InputHook.Start()
}</code></pre></div><div class="quotebox"><cite>avens пишет:</cite><blockquote><p>Другие символы добавлять в массив Chars и Keys для аналогичной замены?</p></blockquote></div><p>Да.</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2023-03-19T06:37:14Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=157232#p157232</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Замена буквы при двойном нажатии горячей клавиши]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=157230#p157230" />
			<content type="html"><![CDATA[<p><strong>serzh82saratov</strong>, у меня частично работает описанный функционал в этом скрипте:<br />Есть баги если по два раза быстро нажимать &quot;ии&quot; то идет замена на &quot;ii&quot; но иногда не заменяет остаётся &quot;и&quot; далее при повторном нажатии идёт один Backspace и &quot;и&quot; удаляется.<br />Плюс эта функция не работает:<br /></p><div class="quotebox"><blockquote><p>Многоразовое быстрое нажатие клавиши &quot;и&quot; или &quot;И&quot; = &quot;ііііі&quot; или &quot;ІІІІІ&quot;</p></blockquote></div><p>Другие символы добавлять в массив Chars и Keys для аналогичной замены?</p><p>Пока использую такой вариант, так как два &quot;ии&quot; есть в словах.<br /></p><div class="codebox"><pre><code>:c*?:ИИИ::І
:c*?:иии::і</code></pre></div>]]></content>
			<author>
				<name><![CDATA[avens]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24487</uri>
			</author>
			<updated>2023-03-18T19:04:55Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=157230#p157230</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Замена буквы при двойном нажатии горячей клавиши]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=157224#p157224" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>teadrinker пишет:</cite><blockquote><p>А, понял, у тебя язык по умолчанию наверно русский. Если английский, тогда вот это</p></blockquote></div><p>Там получается что GetKeySC берёт от раскладки окна скрипта, а не от активного. То есть можно менять раскладку окна скрипта на русскую, тогда будет работать. Но тут проще добавить кнопку в массив.<br /></p><div class="codebox"><pre><code>
ih := InputHook(&quot;V L0&quot;)
ih.OnChar := Func(&quot;OnChar&quot;)
ih.Start()
Return

OnChar(InputHook, Char) {  
	Critical 
	Static PrChar, PrTime
	, Chars := {&quot;#и&quot;:&quot;i&quot;,&quot;#И&quot;:&quot;I&quot;} 
	, Keys := {&quot;#и&quot;:&quot;sc30&quot;,&quot;#И&quot;:&quot;sc30&quot;} 
	If !Chars[&quot;#&quot; Char]
		Return 
	InputHook.Stop()
	Key := GetKeySC(Char) ? Format(&quot;sc{:x}&quot;, GetKeySC(Char)) : Keys[&quot;#&quot; Char]
	KeyWait % Key, T0.25
	If ErrorLevel
	{
		KeyWait % Key
		PrTime := 0 
		Return InputHook.Start()
	}
	If (PrChar == Char &amp;&amp; A_TickCount - PrTime &lt; 250)
	{
		SendInput % &quot;{Backspace 2}&quot;
		SendInput % &quot;{Text}&quot; Chars[&quot;#&quot; Char]
	}  
	PrChar := Char, PrTime := A_TickCount
	InputHook.Start()
}
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2023-03-18T11:46:27Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=157224#p157224</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Замена буквы при двойном нажатии горячей клавиши]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=157141#p157141" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>serzh82saratov пишет:</cite><blockquote><p>Да, ну не знаю тогда, лень копать.</p></blockquote></div><p>Ну, мне тоже лень. <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /></p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2023-03-12T21:01:01Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=157141#p157141</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Замена буквы при двойном нажатии горячей клавиши]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=157140#p157140" />
			<content type="html"><![CDATA[<p>С русской раскладкой по умолчанию вроде работает.</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2023-03-12T20:46:56Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=157140#p157140</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Замена буквы при двойном нажатии горячей клавиши]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=157139#p157139" />
			<content type="html"><![CDATA[<p>Да, ну не знаю тогда, лень копать.</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2023-03-12T20:26:10Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=157139#p157139</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Замена буквы при двойном нажатии горячей клавиши]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=157137#p157137" />
			<content type="html"><![CDATA[<p>При двойном нажатии меняет, при удержании печатает и сразу стирает, то-есть стоит на месте.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2023-03-12T20:21:45Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=157137#p157137</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Замена буквы при двойном нажатии горячей клавиши]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=157135#p157135" />
			<content type="html"><![CDATA[<p>Это как?</p><div class="codebox"><pre><code>

ih := InputHook(&quot;V L0&quot;)
ih.OnChar := Func(&quot;OnChar&quot;)
ih.Start()
Return

OnChar(InputHook, Char) {  
	Critical 
	Static PrChar, PrTime
	, Chars := {&quot;#и&quot;:&quot;i&quot;,&quot;#И&quot;:&quot;I&quot;} 
	If !Chars[&quot;#&quot; Char]
		Return 
	InputHook.Stop()
	Key := GetKeySC(Char) ? Format(&quot;sc{:x}&quot;, GetKeySC(Char)) : Format(&quot;sc{:x}&quot;, GetKeySC(Chars[&quot;#&quot; Char])) 
	KeyWait % Key, T0.25
	If ErrorLevel
	{
		KeyWait % Key
		PrTime := 0 
		Return InputHook.Start()
	}
	If (PrChar == Char &amp;&amp; A_TickCount - PrTime &lt; 250)
	{
		SendInput % &quot;{Backspace 2}&quot;
		SendInput % &quot;{Text}&quot; Chars[&quot;#&quot; Char]
	}  
	PrChar := Char, PrTime := A_TickCount
	InputHook.Start()
}

</code></pre></div>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2023-03-12T19:53:09Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=157135#p157135</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Замена буквы при двойном нажатии горячей клавиши]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=157134#p157134" />
			<content type="html"><![CDATA[<p>Да, ерунда. Ну тогда в массив сканы ещё добавлять.</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2023-03-12T19:48:51Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=157134#p157134</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Замена буквы при двойном нажатии горячей клавиши]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=157133#p157133" />
			<content type="html"><![CDATA[<p>А, понял, у тебя язык по умолчанию наверно русский. Если английский, тогда вот это<br /></p><div class="codebox"><pre><code>1:: MsgBox, % GetKeySC(&quot;и&quot;)</code></pre></div><p>возвращает 0. Попробуй вызвать главное окно скрипта из трея и переключить на английский.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2023-03-12T19:39:53Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=157133#p157133</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Замена буквы при двойном нажатии горячей клавиши]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=157131#p157131" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>teadrinker пишет:</cite><blockquote><p>У меня всегда срабатывает это if, независимо от скорости нажатия:</p></blockquote></div><p>Ну так по твоему должно так быть?</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2023-03-12T18:45:38Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=157131#p157131</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Замена буквы при двойном нажатии горячей клавиши]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=157129#p157129" />
			<content type="html"><![CDATA[<p>У меня всегда срабатывает это if, независимо от скорости нажатия:<br /></p><div class="codebox"><pre><code>	KeyWait % Format(&quot;sc{:x}&quot;, GetKeySC(Char)), T0.25
	If ErrorLevel</code></pre></div><p>Проверял так:<br /></p><div class="codebox"><pre><code>
ih := InputHook(&quot;V L0&quot;)
ih.OnChar := Func(&quot;OnChar&quot;)
ih.Start()
Return

OnChar(InputHook, Char) {
   static counter := 0
	Critical 
	Static PrChar, PrTime
	, Chars := {&quot;#и&quot;:&quot;i&quot;,&quot;#И&quot;:&quot;I&quot;} 
	If !Chars[&quot;#&quot; Char]
		Return 
   
	InputHook.Stop()
	KeyWait % Format(&quot;sc{:x}&quot;, GetKeySC(Char)), T0.25
	If ErrorLevel
	{
      ToolTip % ++counter
		KeyWait % Format(&quot;sc{:x}&quot;, GetKeySC(Char))
		PrTime := 0 
		Return InputHook.Start()
	}
	If (PrChar == Char &amp;&amp; A_TickCount - PrTime &lt; 250)
	{
		SendInput % &quot;{Backspace 2}&quot;
		SendInput % &quot;{Text}&quot; Chars[&quot;#&quot; Char]
	}  
	PrChar := Char, PrTime := A_TickCount
	InputHook.Start()
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2023-03-12T18:41:42Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=157129#p157129</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Замена буквы при двойном нажатии горячей клавиши]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=157125#p157125" />
			<content type="html"><![CDATA[<p>Ага, но у меня работает.<br />Посмотри код, что там работать у тебя не должно?</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2023-03-12T18:21:49Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=157125#p157125</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Замена буквы при двойном нажатии горячей клавиши]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=157123#p157123" />
			<content type="html"><![CDATA[<p>Так же. Там вроде нет ничего, что должно работать по-разному на разных битностях.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2023-03-12T18:20:12Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=157123#p157123</id>
		</entry>
</feed>
