<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Серый форум &mdash; AHK: Перебор меток после удержания горячей клавиши]]></title>
		<link>https://forum.script-coding.com/viewtopic.php?id=12136</link>
		<atom:link href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=12136&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «AHK: Перебор меток после удержания горячей клавиши».]]></description>
		<lastBuildDate>Thu, 01 Feb 2018 14:16:11 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: AHK: Перебор меток после удержания горячей клавиши]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=123527#p123527</link>
			<description><![CDATA[<p><strong>stealzy</strong>, а как решить проблему, при которой зажатие не работает, если рядом задана горячая клавиша с буквой <strong>M</strong>?</p><div class="codebox"><pre><code>^+m::MsgBox 123</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (becauseim)]]></author>
			<pubDate>Thu, 01 Feb 2018 14:16:11 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=123527#p123527</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Перебор меток после удержания горячей клавиши]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=123382#p123382</link>
			<description><![CDATA[<p><strong>becauseim</strong><br /></p><div class="codebox"><pre><code>$^+m::MsgBox 123
MsgBox MsgBox не работает</code></pre></div><div class="quotebox"><cite>becauseim пишет:</cite><blockquote><p>в конкретном окне?</p></blockquote></div><p>Попроще: проверяете активность конкретного окна, посложнее: ставите оконный хук и вкл/выкл хоткей на активацию/появление окон.</p>]]></description>
			<author><![CDATA[null@example.com (stealzy)]]></author>
			<pubDate>Thu, 25 Jan 2018 21:49:06 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=123382#p123382</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Перебор меток после удержания горячей клавиши]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=123377#p123377</link>
			<description><![CDATA[<p><strong>teadrinker</strong>, зажатие не работает, если рядом задан хотей, например, ^+{m}. <br />И все еще не понял, как задать работу зажатия в конкретном окне? <strong>stealzy</strong> привел пример, но он отличается от Вашей ф-ии.<br /></p><div class="codebox"><pre><code>$^+m:: MsgBox 123
#Persistent
Hold(&quot;sc32&quot;, 300, 500, &quot;^+{f2}&quot;, &quot;^+{f7}&quot;, &quot;^+{f5}&quot;, &quot;^+{f6}&quot;, &quot;^+{f8}&quot;, &quot;^+{f4}&quot;, &quot;^+{f3}&quot;, &quot;^+{f1}&quot;)


Hold(MyHotkey, TimeOut, SleepTime, HeldKeys*)  {
   static oInfo, WH_KEYBOARD_LL := 13
   oInfo := { MyHotkey: MyHotkey, MyHotkeySC: &quot;0x&quot; . SubStr(MyHotkey, 3)
            , TimeOut: TimeOut, SleepTime: SleepTime, HeldKeys: HeldKeys }
   
   DllCall(&quot;SetWindowsHookEx&quot;, Int, WH_KEYBOARD_LL
      , Ptr, RegisterCallback(&quot;LowLevelKeyboardProc&quot;, &quot;Fast&quot;, 3, pInfo := Object(oInfo))
      , Ptr, DllCall(&quot;GetModuleHandle&quot;, UInt, 0, Ptr), UInt, 0, Ptr)
   ObjRelease(pInfo)
}

LowLevelKeyboardProc(nCode, wParam, lParam)  {
   static LLKHF_INJECTED := 0x10, WM_KEYDOWN := 0x100, WM_KEYUP := 0x101, timer
   
   Critical
   msg   := wParam
   flags := NumGet(lParam + 8, &quot;UInt&quot;)
   ext   := flags &amp; 1
   sc    := NumGet(lParam + 4, &quot;UInt&quot;) | ext &lt;&lt; 8
   time  := NumGet(lParam + 12, &quot;UInt&quot;)
   INJECTED := (flags &amp; LLKHF_INJECTED) &gt;&gt; 4
   oInfo := Object(A_EventInfo)
   
   if (!INJECTED &amp;&amp; msg = WM_KEYDOWN &amp;&amp; oInfo.KeyDownTime != &quot;&quot;)
      Return 1
   
   if (!INJECTED &amp;&amp; msg = WM_KEYDOWN &amp;&amp; sc = oInfo.MyHotkeySC &amp;&amp; oInfo.KeyDownTime = &quot;&quot;)  {
      if GetKeyState(&quot;Shift&quot;, &quot;P&quot;) || GetKeyState(&quot;Alt&quot;, &quot;P&quot;) || GetKeyState(&quot;Ctrl&quot;, &quot;P&quot;)
         Return DllCall(&quot;CallNextHookEx&quot;, Ptr, 0, Int, nCode, Ptr, wParam, Ptr, lParam)
      
      oInfo.KeyDownTime := time
      timer := Func(&quot;SendKeys&quot;).Bind(oInfo)
      SetTimer, % timer, % &quot;-&quot; . oInfo.TimeOut
      Return 1
   }
   
   if (!INJECTED &amp;&amp; msg = WM_KEYUP &amp;&amp; sc = oInfo.MyHotkeySC &amp;&amp; oInfo.KeyDownTime != &quot;&quot;)  {
      SetTimer, % timer, Delete
      if (A_TickCount - oInfo.KeyDownTime &lt;= oInfo.TimeOut)
         SendInput, % &quot;{&quot; oInfo.MyHotkey &quot;}&quot;
      oInfo.KeyDownTime := &quot;&quot;
      Return 1
   }
   Return DllCall(&quot;CallNextHookEx&quot;, Ptr, 0, Int, nCode, Ptr, wParam, Ptr, lParam)
}

SendKeys(oInfo)  {
   max := oInfo.HeldKeys.MaxIndex()
   while oInfo.KeyDownTime  {
      SendInput, % oInfo.HeldKeys[(k := mod(A_Index, max)) ? k : max]
      Sleep, oInfo.SleepTime
   }
}</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (becauseim)]]></author>
			<pubDate>Thu, 25 Jan 2018 20:46:55 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=123377#p123377</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Перебор меток после удержания горячей клавиши]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=114154#p114154</link>
			<description><![CDATA[<div class="quotebox"><cite>becauseim пишет:</cite><blockquote><p><strong>teadrinker</strong>, горячая клавиша глобальна, несмотря на установку. Что я делаю неправильно?</p></blockquote></div><p>А в моем скрипте нет установки горячих клавиш, там другой механизм.</p>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Sun, 26 Mar 2017 08:56:06 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=114154#p114154</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Перебор меток после удержания горячей клавиши]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=114137#p114137</link>
			<description><![CDATA[<p>Вы не задали ГК между двумя диезами.<br />Выражения # обрабатываются отдельно до запуска скрипта и внутрь ф-ии не глядят.<br />Либо разверните ф-ию между #If, либо засуньте #If внутрь ф-ии.<br />Правильным подходом будет использование Hotkey, тогда вы сможете передать WinTitle как параметр ф-ии.<br /></p><div class="codebox"><pre><code>Hotkey(&quot;ctrl shift C&quot;, &quot;ahk_class CabinetWClass&quot;, &quot;Explorer_CopySelPath&quot;, true, true, false) ; копирование пути выделеного в проводнике объекта

Hotkey(keyName, winTitle:=&quot;&quot;, func:=&quot;&quot;, args*)  {
	keyName := GetAHKhotkey(keyName) ; &quot;ctrl shift C&quot; → ^+vk43
	funcObj := Func(func).Bind(args*)
	Hotkey IfWinActive, % winTitle
	Hotkey % keyName, % funcObj
}</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (stealzy)]]></author>
			<pubDate>Sun, 26 Mar 2017 05:49:00 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=114137#p114137</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Перебор меток после удержания горячей клавиши]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=114134#p114134</link>
			<description><![CDATA[<p><strong>teadrinker</strong>, горячая клавиша глобальна, несмотря на установку. Что я делаю неправильно?<br /></p><div class="codebox"><pre><code>
#Persistent
#IfWinActive ahk_exe app.exe 
Hold( &quot;sc32&quot;, 300, 100, &quot;+{m}&quot;, &quot;{y}&quot;, &quot;+{s}&quot;, &quot;{c}&quot;, &quot;{r}&quot;, &quot;{i}&quot;, &quot;{p}&quot;, &quot;{t}&quot;, &quot;{sc39}&quot; )
Return
#IfWinActive
</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (becauseim)]]></author>
			<pubDate>Sun, 26 Mar 2017 05:26:37 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=114134#p114134</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Перебор меток после удержания горячей клавиши]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=113996#p113996</link>
			<description><![CDATA[<div class="quotebox"><cite>becauseim пишет:</cite><blockquote><p>вот изначальный Ваш вариант, который мне подходит.</p></blockquote></div><p>Он недостаточно надёжный, в нём иногда сама нажатая клавиша отсылается.</p>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Fri, 24 Mar 2017 16:03:10 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=113996#p113996</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Перебор меток после удержания горячей клавиши]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=113957#p113957</link>
			<description><![CDATA[<p><strong>teadrinker</strong>, <a href="http://forum.script-coding.com/viewtopic.php?pid=109019#p109019">вот</a> изначальный Ваш вариант, который мне подходит. Для того, чтобы задать несколько клавиш подобного функционала показалось целесообразным заключить скрипт в функцию, чтобы не увеличивать объем, да и упростить задание таких клавиш.</p>]]></description>
			<author><![CDATA[null@example.com (becauseim)]]></author>
			<pubDate>Fri, 24 Mar 2017 09:50:48 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=113957#p113957</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Перебор меток после удержания горячей клавиши]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=113953#p113953</link>
			<description><![CDATA[<p><strong>becauseim</strong>, я уже запутался, какой именно первый? Ничего невозможного нет, просто я нашёл такое решение в соответствии с задачей, кто-то, может, нашёл бы более короткое.</p>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Fri, 24 Mar 2017 09:10:32 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=113953#p113953</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Перебор меток после удержания горячей клавиши]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=113944#p113944</link>
			<description><![CDATA[<p><strong>teadrinker</strong>, да, я заметил, что здесь задействованы системные функции, но не понял, для чего, если предыдущий вариант работал с той же скоростью и столь же стабильно, как мне кажется. Или первый вариант не возможно заключить в функцию без изенения подхода?</p>]]></description>
			<author><![CDATA[null@example.com (becauseim)]]></author>
			<pubDate>Thu, 23 Mar 2017 19:03:30 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=113944#p113944</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Перебор меток после удержания горячей клавиши]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=113906#p113906</link>
			<description><![CDATA[<p><strong>becauseim</strong>, если вы заметили, тут совсем другой подход.</p>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Wed, 22 Mar 2017 08:10:11 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=113906#p113906</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Перебор меток после удержания горячей клавиши]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=113903#p113903</link>
			<description><![CDATA[<p><strong>teadrinker</strong>, да, вроде работает. Спасибо! Скажите, а почему же последний вариант столь сильно увеличился в объеме в сравнении с <a href="http://forum.script-coding.com/viewtopic.php?pid=109019#p109019">вариантом без оформления в функцию</a>?</p>]]></description>
			<author><![CDATA[null@example.com (becauseim)]]></author>
			<pubDate>Wed, 22 Mar 2017 05:24:47 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=113903#p113903</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Перебор меток после удержания горячей клавиши]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=113900#p113900</link>
			<description><![CDATA[<p>У меня так вроде работает:<br /></p><div class="codebox"><pre><code>#Persistent
Hold( &quot;sc32&quot;  ; m
     , 300, 100
     , &quot;+{m}&quot;, &quot;{y}&quot;, &quot;+{s}&quot;, &quot;{c}&quot;, &quot;{r}&quot;, &quot;{i}&quot;, &quot;{p}&quot;, &quot;{t}&quot;, &quot;{sc39}&quot; )
Return

Hold(MyHotkey, TimeOut, SleepTime, HeldKeys*)  {
   static oInfo, WH_KEYBOARD_LL := 13
   oInfo := { MyHotkey: MyHotkey, MyHotkeySC: &quot;0x&quot; . SubStr(MyHotkey, 3)
            , TimeOut: TimeOut, SleepTime: SleepTime, HeldKeys: HeldKeys }
   
   DllCall(&quot;SetWindowsHookEx&quot;, Int, WH_KEYBOARD_LL
      , Ptr, RegisterCallback(&quot;LowLevelKeyboardProc&quot;, &quot;Fast&quot;, 3, pInfo := Object(oInfo))
      , Ptr, DllCall(&quot;GetModuleHandle&quot;, UInt, 0, Ptr), UInt, 0, Ptr)
   ObjRelease(pInfo)
}

LowLevelKeyboardProc(nCode, wParam, lParam)  {
   static LLKHF_INJECTED := 0x10, WM_KEYDOWN := 0x100, WM_KEYUP := 0x101, timer
   
   Critical
   msg   := wParam
   flags := NumGet(lParam + 8, &quot;UInt&quot;)
   ext   := flags &amp; 1
   sc    := NumGet(lParam + 4, &quot;UInt&quot;) | ext &lt;&lt; 8
   time  := NumGet(lParam + 12, &quot;UInt&quot;)
   INJECTED := (flags &amp; LLKHF_INJECTED) &gt;&gt; 4
   oInfo := Object(A_EventInfo)
   
   if (!INJECTED &amp;&amp; msg = WM_KEYDOWN &amp;&amp; oInfo.KeyDownTime != &quot;&quot;)
      Return 1
   
   if (!INJECTED &amp;&amp; msg = WM_KEYDOWN &amp;&amp; sc = oInfo.MyHotkeySC &amp;&amp; oInfo.KeyDownTime = &quot;&quot;)  {
      if GetKeyState(&quot;Shift&quot;, &quot;P&quot;) || GetKeyState(&quot;Alt&quot;, &quot;P&quot;) || GetKeyState(&quot;Ctrl&quot;, &quot;P&quot;)
         Return DllCall(&quot;CallNextHookEx&quot;, Ptr, 0, Int, nCode, Ptr, wParam, Ptr, lParam)
      
      oInfo.KeyDownTime := time
      timer := Func(&quot;SendKeys&quot;).Bind(oInfo)
      SetTimer, % timer, % &quot;-&quot; . oInfo.TimeOut
      Return 1
   }
   
   if (!INJECTED &amp;&amp; msg = WM_KEYUP &amp;&amp; sc = oInfo.MyHotkeySC &amp;&amp; oInfo.KeyDownTime != &quot;&quot;)  {
      SetTimer, % timer, Delete
      if (A_TickCount - oInfo.KeyDownTime &lt;= oInfo.TimeOut)
         SendInput, % &quot;{&quot; oInfo.MyHotkey &quot;}&quot;
      oInfo.KeyDownTime := &quot;&quot;
      Return 1
   }
   Return DllCall(&quot;CallNextHookEx&quot;, Ptr, 0, Int, nCode, Ptr, wParam, Ptr, lParam)
}

SendKeys(oInfo)  {
   max := oInfo.HeldKeys.MaxIndex()
   while oInfo.KeyDownTime  {
      SendInput, % oInfo.HeldKeys[(k := mod(A_Index, max)) ? k : max]
      Sleep, oInfo.SleepTime
   }
}</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Tue, 21 Mar 2017 18:18:00 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=113900#p113900</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Перебор меток после удержания горячей клавиши]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=113898#p113898</link>
			<description><![CDATA[<p><strong>teadrinker</strong>, спасибо! А как исключить работу гк из других сочетаний? Например, функция срабатывает даже при зажатии Ctrl+Shift+M.</p>]]></description>
			<author><![CDATA[null@example.com (becauseim)]]></author>
			<pubDate>Tue, 21 Mar 2017 13:02:10 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=113898#p113898</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Перебор меток после удержания горячей клавиши]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=113893#p113893</link>
			<description><![CDATA[<p>Сочетание Shift+b имеет смысл, только если эмулировано нажатие клавиши «b», а когда в данной раскладке такой клавиши нет, отправка осуществляется по-другому, читайте справку по Send.</p>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Tue, 21 Mar 2017 10:12:26 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=113893#p113893</guid>
		</item>
	</channel>
</rss>
