<?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=6028&amp;type=atom" />
	<updated>2011-07-27T01:04:15Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=6028</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Запомнить порядок активации окон]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=50212#p50212" />
			<content type="html"><![CDATA[<p>Grey, спасибо, работает!</p>]]></content>
			<author>
				<name><![CDATA[Pokerist]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24990</uri>
			</author>
			<updated>2011-07-27T01:04:15Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=50212#p50212</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Запомнить порядок активации окон]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=50183#p50183" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>DetectHiddenWindows, On
SetWinDelay, 0
TH := 6
Capacity := 10
WinArray := []
Gui, +LastFound +ToolWindow -Caption +AlwaysOnTop +Disabled
WinGet, FrameID
Gui, Color, Yellow
SetTimer, Frame, 50
Loop
   {
      WinGet, ID,, A
      If (!ChangeActiveHotkey &amp;&amp; ID != WinArray.1)
         {
            WinArray.Insert(1, ID)
            WinArray.Remove(Capacity + 1)
            CurrentWin = 1
         }
      ChangeActiveHotkey =
      WinWaitNotActive % &quot;ahk_id&quot; ID
   }
Return

Frame:
   WinGetPos, X, Y, W, H, A
   If (X = XPrev &amp;&amp; Y = YPrev &amp;&amp; W = WPrev &amp;&amp; H = HPrev)
      Return
   XPrev := X, YPrev := Y, WPrev := W, HPrev := H
   X -= TH, Y -= TH, W += 2*TH, H += 2*TH
   Gui, Show, x%X% y%Y% w%W% h%H% Hide
   Options := &quot;0-0 &quot;W &quot;-0 &quot;W &quot;-&quot;H &quot; 0-&quot;H &quot; 0-0 &quot;TH &quot;-&quot;TH
   . &quot; &quot;W-TH &quot;-&quot;TH &quot; &quot;W-TH &quot;-&quot;H-TH &quot; &quot;TH &quot;-&quot;H-TH &quot; &quot;TH &quot;-&quot;TH
   WinSet, Region, % Options, % &quot;ahk_id&quot; FrameID
   Gui, Show, NA
   Return

^Left::
^Right::
   limit := A_ThisHotkey = &quot;^Left&quot; ? WinArray.MaxIndex() : 1
   If (CurrentWin = limit)
      Return
   ChangeActiveHotkey = 1
   CurrentWin := A_ThisHotkey = &quot;^Left&quot; ? ++CurrentWin : --CurrentWin
   WinActivate % &quot;ahk_id &quot; WinArray[CurrentWin]
   Return</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Grey]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=25792</uri>
			</author>
			<updated>2011-07-26T00:36:35Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=50183#p50183</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Запомнить порядок активации окон]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=50180#p50180" />
			<content type="html"><![CDATA[<p>Попытался внести код в уже готовый скрипт, где уже работают другие функции и потерпел фиаско. <img src="//forum.script-coding.com/img/smilies/sad.png" width="15" height="15" /><br />&nbsp; Если этот код не ставить первым - он не выполняется. У меня уже есть такой фрагмент, который должен стоять первым, чтобы выполняться:</p><div class="codebox"><pre><code>;--------------  Рамка
TH = 6   ; толщина рамки

   SetWinDelay, 0
   Gui, +LastFound +ToolWindow -Caption +AlwaysOnTop +Disabled
   WinGet, ID
   Gui, Color, Yellow

   SetTimer, Frame, 50
   Return

Frame:
   WinGetPos, X, Y, W, H, A
   if (X = XPrev &amp;&amp; Y = YPrev &amp;&amp; W = WPrev &amp;&amp; H = HPrev)
      Return

   XPrev := X, YPrev := Y, WPrev := W, HPrev := H
   X -= TH, Y -= TH, W += 2*TH, H += 2*TH

   Gui, Show, x%X% y%Y% w%W% h%H% Hide
   Options := &quot;0-0 &quot; W &quot;-0 &quot; W &quot;-&quot; H &quot; 0-&quot; H &quot; 0-0 &quot; TH &quot;-&quot; TH
      . &quot; &quot; W-TH &quot;-&quot; TH &quot; &quot; W-TH &quot;-&quot; H-TH &quot; &quot; TH &quot;-&quot; H-TH &quot; &quot; TH &quot;-&quot; TH
   DetectHiddenWindows, On
   WinSet, Region, % Options, ahk_id %ID%
   Gui, Show, NA
   Return</code></pre></div><p>Что нужно сделать, чтобы они оба кода работали в одном скрипте?</p>]]></content>
			<author>
				<name><![CDATA[Pokerist]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24990</uri>
			</author>
			<updated>2011-07-25T22:45:05Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=50180#p50180</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Запомнить порядок активации окон]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=50148#p50148" />
			<content type="html"><![CDATA[<p>teadrinker, всё работает отлично! Безумно благодарен!</p>]]></content>
			<author>
				<name><![CDATA[Pokerist]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24990</uri>
			</author>
			<updated>2011-07-24T11:37:08Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=50148#p50148</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Запомнить порядок активации окон]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=50123#p50123" />
			<content type="html"><![CDATA[<p>Спасибо, помогло!</p>]]></content>
			<author>
				<name><![CDATA[Pokerist]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24990</uri>
			</author>
			<updated>2011-07-22T23:27:15Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=50123#p50123</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Запомнить порядок активации окон]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=50121#p50121" />
			<content type="html"><![CDATA[<p>Для совместимости со скриптами, написанными под AHK-basic, лучше пользоваться ANSI-версией AHK_L. Если всё же установлена Unicode-версия, то под неё скрипты нужно сохранять в формате Utf-8.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2011-07-22T22:42:14Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=50121#p50121</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Запомнить порядок активации окон]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=50119#p50119" />
			<content type="html"><![CDATA[<p>Обновил. Из того, что успел проверить - работает отлично. К сожалению отрубилась половина клавишей в другом скрипте, скорее всего из-за обновления. Разбираюсь.</p>]]></content>
			<author>
				<name><![CDATA[Pokerist]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24990</uri>
			</author>
			<updated>2011-07-22T22:36:20Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=50119#p50119</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Запомнить порядок активации окон]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=50118#p50118" />
			<content type="html"><![CDATA[<p>Нет, боюсь, у тебя старая версия AHK! Обнови.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2011-07-22T19:53:16Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=50118#p50118</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Запомнить порядок активации окон]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=50117#p50117" />
			<content type="html"><![CDATA[<p>Ух ты! И коротко так получилось! Здорово! Только он что-то на <br /></p><div class="codebox"><pre><code>WinArray.1</code></pre></div><p>ругается. Неврный символ?</p>]]></content>
			<author>
				<name><![CDATA[Pokerist]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24990</uri>
			</author>
			<updated>2011-07-22T19:43:16Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=50117#p50117</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Запомнить порядок активации окон]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=50098#p50098" />
			<content type="html"><![CDATA[<p>Мой вариант (без учёта несуществования окна):<br /></p><div class="codebox"><pre><code>   Capacity = 10   ; сколько окон запоминать

   WinArray := []
   Loop
   {
      WinGet, ID,, A
      if (!ChangeActiveHotkey &amp;&amp; ID != WinArray.1)
      {
         WinArray.Insert(1, ID)
         WinArray.Remove(Capacity + 1)
         CurrentWin = 1
      }
      ChangeActiveHotkey =
      WinWaitNotActive, ahk_id %ID%
   }
   Return

^Left::
^Right::
   limit := A_ThisHotkey = &quot;^Left&quot; ? WinArray.MaxIndex() : 1
   if (CurrentWin = limit)
      Return
      
   ChangeActiveHotkey = 1
   CurrentWin := A_ThisHotkey = &quot;^Left&quot; ? ++CurrentWin : --CurrentWin
   WinActivate, % &quot;ahk_id &quot; WinArray[CurrentWin]
   Return</code></pre></div><p>Листает по горячим клавишам <em>Ctrl + Left</em> и <em>Ctrl + Right</em>.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2011-07-22T11:18:37Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=50098#p50098</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Запомнить порядок активации окон]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=50086#p50086" />
			<content type="html"><![CDATA[<p>Забыл глаза разуть когда документацию читал <img src="//forum.script-coding.com/img/smilies/big_smile.png" width="15" height="15" /></p>]]></content>
			<author>
				<name><![CDATA[MixaLich]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27090</uri>
			</author>
			<updated>2011-07-22T09:05:18Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=50086#p50086</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Запомнить порядок активации окон]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=50085#p50085" />
			<content type="html"><![CDATA[<p>WinWaitNotActive, такой команды не знал, в хозяйстве пригодится:).</p>]]></content>
			<author>
				<name><![CDATA[MixaLich]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27090</uri>
			</author>
			<updated>2011-07-22T09:02:39Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=50085#p50085</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Запомнить порядок активации окон]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=50083#p50083" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>MixaLich пишет:</cite><blockquote><p>Да, в этом варианте кликать для запоминания надо. По иному в голову пока ничего больше не приходит.</p></blockquote></div><p>Примерно так:<br /></p><div class="codebox"><pre><code>MAX_WINDOWS := 3 ;сколько окон запоминаем
stop		:= 0

;обнуляем все дескрипторы
i:=0
while i&lt;=MAX_WINDOWS
{
	window%i%:=0
	i:=i+1
}

WinGet, cur, ID, A
window1:=cur
while stop==0
{
	;ждём пока текущее окно не потеряет фокус
	WinWaitNotActive ahk_id%cur%
	;получаем дескриптор нового активного окна
	WinGet, cur, ID, A
	;если получить не удалось, то ждём 1/20 секунды и пробуем снова.
	;Если и тогда не получится, то переходим к следующему витку цикла
	if cur=
	{
		sleep 50
		WinGet, cur, ID, A
		if cur=
			continue
	}
	;ищем текущее окно в сохранённых
	i := 1
	while i&lt;= MAX_WINDOWS
	{
		if(cur=window%i%)
		{
			break
		}
		i:=i+1
	}
	;если нету, то будем менять последний
	if(i&gt;MAX_WINDOWS)
	{
		i:=MAX_WINDOWS
	}
	;меняем
	while i &gt; 1
	{
		k := i-1
		window%i% := window%k%
		i := k
	}
	window1 := cur
}
;===========================================

F2::
	;если окно ещё существует, то показываем его, иначе выводим сообщение
	ifWinExist ahk_id%window2%
		WinActivate ahk_id%window2%
	else
		msgbox Окна уже нет
return
F3::
	ifWinExist ahk_id%window3%
		WinActivate ahk_id%window3%
	else
		msgbox Окна уже нет
return
F12:: 
	;прервать слежку за окнами после смены этого окна
	stop := 1
return</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Александр_]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24888</uri>
			</author>
			<updated>2011-07-22T08:39:59Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=50083#p50083</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Запомнить порядок активации окон]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=50053#p50053" />
			<content type="html"><![CDATA[<p>Да, в этом варианте кликать для запоминания надо. По иному в голову пока ничего больше не приходит.</p>]]></content>
			<author>
				<name><![CDATA[MixaLich]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27090</uri>
			</author>
			<updated>2011-07-21T11:46:46Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=50053#p50053</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Запомнить порядок активации окон]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=50050#p50050" />
			<content type="html"><![CDATA[<p>Получается, что без специальной активации с помощью клика мышкой запоминания не происходит?</p>]]></content>
			<author>
				<name><![CDATA[Pokerist]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24990</uri>
			</author>
			<updated>2011-07-21T10:42:17Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=50050#p50050</id>
		</entry>
</feed>
