<?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>http://forum.script-coding.com/viewtopic.php?id=8801</link>
		<atom:link href="http://forum.script-coding.com/extern.php?action=feed&amp;tid=8801&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «AHK : Два процесса в из одного файла?».]]></description>
		<lastBuildDate>Thu, 24 Oct 2013 05:51:12 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: AHK : Два процесса в из одного файла?]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=76387#p76387</link>
			<description><![CDATA[<div class="codebox"><pre><code>
#SingleInstance off
OnMessage( DllCall(&quot;RegisterWindowMessage&quot;, &quot;Str&quot;, &quot;WM_HIGHLANDER&quot;), &quot;Receive_WM_HIGHLANDER&quot;)
OnExit Exit
Param = %1%
IsFunc(Param) ? %Param%() : (CloseAllSame(), proc1())

Return

proc1()  {  
    Run, %A_ScriptFullPath% proc2 
    loop
        ToolTip % A_ThisFunc &quot;`n&quot; A_TickCount &quot;`nProcessId = &quot; DllCall(&quot;GetCurrentProcessId&quot;),111,111
}

proc2()  { 
    Menu, Tray, NoIcon 
    loop
        ToolTip % A_ThisFunc &quot;`n&quot; A_TickCount &quot;`nProcessId = &quot; DllCall(&quot;GetCurrentProcessId&quot;),111,222 
} 

CloseAllSame()   {
    WM_HIGHLANDER := DllCall(&quot;RegisterWindowMessage&quot;, &quot;Str&quot;, &quot;WM_HIGHLANDER&quot;)
    PostMessage, WM_HIGHLANDER, 0, A_ScriptHWND,, ahk_id 0xFFFF 
 
}

Receive_WM_HIGHLANDER(wParam, lParam)   {
    If (lParam &lt;&gt; A_ScriptHWND)
        ExitApp
    return true
}

Exit:  
    If A_ExitReason = Menu
        CloseAllSame() 
    ExitApp
    
~Esc:: ExitApp
</code></pre></div><p><a href="http://forum.script-coding.com/viewtopic.php?pid=84612#p84612">Вот получше решение.</a></p>]]></description>
			<author><![CDATA[null@example.com (serzh82saratov)]]></author>
			<pubDate>Thu, 24 Oct 2013 05:51:12 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=76387#p76387</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK : Два процесса в из одного файла?]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=76382#p76382</link>
			<description><![CDATA[<p>Проверил как сумел:<br /></p><div class="codebox"><pre><code>#SingleInstance off
 
Param = %1%
IsFunc(Param) ? %Param%() : proc1() 
Return
 
; \|/ \|/  \|/  \|/  \|/  \|/  \|/  \|/  \|/  \|/  \|/  \|/  \|/ 
 

proc1()  {  
   Run, %A_ScriptFullPath% proc2 
   ; содержимое odin.ahk
   loop,100
      {
      ToolTip, % A_MSec,700,700,1
      sleep, 777
      }
}

proc2()  { 
    ; содержимое dva.ahk
    loop,10000
      {
      ToolTip, % A_MSec,700,730,2      
      }
} </code></pre></div><p>&nbsp; &nbsp;Отлично работает, независимо друг от друга. Два одноименный процесса.&nbsp; Спасибо!<br />&nbsp; &nbsp;Осталось разобраться с иконками и управлением через трей. Пока только один процесс&nbsp; убивается через &quot;Exit&quot;.</p>]]></description>
			<author><![CDATA[null@example.com (Next)]]></author>
			<pubDate>Wed, 23 Oct 2013 23:35:05 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=76382#p76382</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK : Два процесса в из одного файла?]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=76369#p76369</link>
			<description><![CDATA[<div class="quotebox"><cite>Irbis пишет:</cite><blockquote><p><a href="http://forum.script-coding.com/viewtopic.php?id=8584">This</a></p></blockquote></div><p><a href="http://www.autohotkey.com/board/topic/56141-ahkv2-dynarun-run-autohotkey-process-dynamically/">And that</a></p>]]></description>
			<author><![CDATA[null@example.com (Drugoy)]]></author>
			<pubDate>Wed, 23 Oct 2013 15:26:27 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=76369#p76369</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK : Два процесса в из одного файла?]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=76368#p76368</link>
			<description><![CDATA[<div class="quotebox"><cite>Next пишет:</cite><blockquote><p>Что-то я пока не понял как должен работать код из 11. Из *.ahk запускается два скрипта, а после компиляции и запуска *.exe, в диспетчере только один процесс видно, да и тот потом исчезает.</p></blockquote></div><p>Если так смущает иконка в трее, можно для второй и последующих запущенных &quot;копий&quot; скрыть иконку<br /></p><div class="codebox"><pre><code>proc2()
{
   Menu, Tray, NoIcon 
   ; ... dva.ahk
}</code></pre></div><p>После компиляции скрипт из #11 работает так же точно, пока не закрыт ни один из MsgBox, будут оба процесса.</p>]]></description>
			<author><![CDATA[null@example.com (Irbis)]]></author>
			<pubDate>Wed, 23 Oct 2013 15:19:05 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=76368#p76368</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK : Два процесса в из одного файла?]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=76366#p76366</link>
			<description><![CDATA[<p>Так, понятнее?<br /></p><div class="codebox"><pre><code>

#SingleInstance off
 
Param = %1%
IsFunc(Param) ? %Param%() : proc1() 
Return
 
; \|/ \|/  \|/  \|/  \|/  \|/  \|/  \|/  \|/  \|/  \|/  \|/  \|/ 
 

proc1()  {  
    Run, %A_ScriptFullPath% proc2 
    ; содержимое odin.ahk
}

proc2()  { 
    ; содержимое dva.ahk
} 
 
 
; /|\ /|\  /|\  /|\  /|\  /|\  /|\  /|\  /|\  /|\  /|\  /|\  /|\ 

</code></pre></div><br /><div class="fancy_spoiler_switcher"><div class="fancy_spoiler_switcher_header"><strong>+</strong>&nbsp;Если не понятно с функциями, можно также с метками:</div><div class="fancy_spoiler"><div class="codebox"><pre><code>
#SingleInstance off
 
Param = %1% 
GoTo % IsLabel(Param) ? Param : &quot;odin_ahk&quot;

; \|/ \|/  \|/  \|/  \|/  \|/  \|/  \|/  \|/  \|/  \|/  \|/  \|/ 


odin_ahk:
    Run, &quot;%A_ScriptFullPath%&quot; dva_ahk
    MsgBox содержимое odin.ahk
    Return

dva_ahk:
    MsgBox содержимое dva.ahk
    Return
 
 
; /|\ /|\  /|\  /|\  /|\  /|\  /|\  /|\  /|\  /|\  /|\  /|\  /|\
</code></pre></div></div></div>]]></description>
			<author><![CDATA[null@example.com (serzh82saratov)]]></author>
			<pubDate>Wed, 23 Oct 2013 13:18:17 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=76366#p76366</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK : Два процесса в из одного файла?]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=76365#p76365</link>
			<description><![CDATA[<p>Я о &quot;своих&quot; двух речь веду. Ну вот создал я два скрипта. odin.ahk и dva.ahk. А потом беру один из ваших вариантов ... и?</p>]]></description>
			<author><![CDATA[null@example.com (Next)]]></author>
			<pubDate>Wed, 23 Oct 2013 13:11:10 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=76365#p76365</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK : Два процесса в из одного файла?]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=76364#p76364</link>
			<description><![CDATA[<p>Это полный код скрипта. Их не надо объединять, это просто три варианта одного и того же.<br />Запускаешь один любой из них, и делаешь выводы.</p>]]></description>
			<author><![CDATA[null@example.com (serzh82saratov)]]></author>
			<pubDate>Wed, 23 Oct 2013 12:45:07 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=76364#p76364</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK : Два процесса в из одного файла?]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=76363#p76363</link>
			<description><![CDATA[<p>Где должен располагаться код двух вышеупомянутых скриптов?</p>]]></description>
			<author><![CDATA[null@example.com (Next)]]></author>
			<pubDate>Wed, 23 Oct 2013 12:32:55 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=76363#p76363</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK : Два процесса в из одного файла?]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=76358#p76358</link>
			<description><![CDATA[<p><strong>Next</strong><br />Не понял вопрос.</p>]]></description>
			<author><![CDATA[null@example.com (serzh82saratov)]]></author>
			<pubDate>Wed, 23 Oct 2013 09:21:25 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=76358#p76358</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK : Два процесса в из одного файла?]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=76354#p76354</link>
			<description><![CDATA[<p><a href="mailto:А лучше так:">А лучше так:</a><br />&nbsp; Я правильно понимаю, что это &quot;стартер&quot; для двух других скриптов?</p>]]></description>
			<author><![CDATA[null@example.com (Next)]]></author>
			<pubDate>Tue, 22 Oct 2013 22:35:04 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=76354#p76354</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK : Два процесса в из одного файла?]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=76349#p76349</link>
			<description><![CDATA[<p>У меня работает:<br /></p><div class="codebox"><pre><code>

#SingleInstance off

Param = %1%
IsFunc(Param) ? %Param%() : proc1() 
Return

proc1()  {  
    Run, %A_ScriptFullPath% proc2 
    loop
        ToolTip % A_ThisFunc &quot;`n&quot; A_TickCount &quot;`nProcessId = &quot; DllCall(&quot;GetCurrentProcessId&quot;),111,111
}

proc2()  {
    Run, %A_ScriptFullPath% proc3 
    loop
        ToolTip % A_ThisFunc &quot;`n&quot; A_TickCount &quot;`nProcessId = &quot; DllCall(&quot;GetCurrentProcessId&quot;),111,222
}

proc3()  { 
    loop
        ToolTip % A_ThisFunc &quot;`n&quot; A_TickCount &quot;`nProcessId = &quot; DllCall(&quot;GetCurrentProcessId&quot;),111,333
}

~Esc:: 
    ExitApp

</code></pre></div><br /><div class="fancy_spoiler_switcher"><div class="fancy_spoiler_switcher_header"><strong>+</strong>&nbsp;Да и ещё при старте без параметра, надо наверное закрыть остальные:</div><div class="fancy_spoiler"><div class="codebox"><pre><code>

#SingleInstance off

Param = %1%
IsFunc(Param) ? %Param%() : proc1() 
Return

proc1()  { 
    CloseAllSame()
    Run, %A_ScriptFullPath% proc2 
    loop
        ToolTip % A_ThisFunc &quot;`n&quot; A_TickCount &quot;`nProcessId = &quot; DllCall(&quot;GetCurrentProcessId&quot;),111,111
}

proc2()  {
    Run, %A_ScriptFullPath% proc3 
    loop
        ToolTip % A_ThisFunc &quot;`n&quot; A_TickCount &quot;`nProcessId = &quot; DllCall(&quot;GetCurrentProcessId&quot;),111,222
}

proc3()  { 
    loop
        ToolTip % A_ThisFunc &quot;`n&quot; A_TickCount &quot;`nProcessId = &quot; DllCall(&quot;GetCurrentProcessId&quot;),111,333
}

CloseAllSame()  {   
    CurPID := DllCall(&quot;GetCurrentProcessId&quot;)
    WinGet, List, List, ahk_exe %A_ScriptFullPath%   ;  только для компилированного
    Loop % List
    {
        WinGet, PID, PID, % &quot;ahk_id &quot; List%A_Index%
        If (PID != CurPID) 
            Process, Close, %PID%
    }
}

~Esc:: 
    ExitApp

</code></pre></div></div></div><div class="fancy_spoiler_switcher"><div class="fancy_spoiler_switcher_header"><strong>+</strong>&nbsp;А лучше так:</div><div class="fancy_spoiler"><div class="codebox"><pre><code>

#SingleInstance off

OnMessage( DllCall(&quot;RegisterWindowMessage&quot;, &quot;Str&quot;, &quot;WM_HIGHLANDER&quot;), &quot;Receive_WM_HIGHLANDER&quot;)
Param = %1%
IsFunc(Param) ? %Param%() : (CloseAllSame(), proc1())
Return

proc1()  {  
    Run, %A_ScriptFullPath% proc2 
    loop
        ToolTip % A_ThisFunc &quot;`n&quot; A_TickCount &quot;`nProcessId = &quot; DllCall(&quot;GetCurrentProcessId&quot;),111,111
}

proc2()  {
    Run, %A_ScriptFullPath% proc3 
    loop
        ToolTip % A_ThisFunc &quot;`n&quot; A_TickCount &quot;`nProcessId = &quot; DllCall(&quot;GetCurrentProcessId&quot;),111,222
}

proc3()  { 
    loop
        ToolTip % A_ThisFunc &quot;`n&quot; A_TickCount &quot;`nProcessId = &quot; DllCall(&quot;GetCurrentProcessId&quot;),111,333
} 

CloseAllSame()   {
    WM_HIGHLANDER := DllCall(&quot;RegisterWindowMessage&quot;, &quot;Str&quot;, &quot;WM_HIGHLANDER&quot;)
    PostMessage, WM_HIGHLANDER, 0, A_ScriptHWND,, ahk_id 0xFFFF 
}

Receive_WM_HIGHLANDER(wParam, lParam)   {
    If (lParam &lt;&gt; A_ScriptHWND)
        ExitApp
    return true
}

~Esc:: 
    ExitApp

</code></pre></div></div></div>]]></description>
			<author><![CDATA[null@example.com (serzh82saratov)]]></author>
			<pubDate>Tue, 22 Oct 2013 19:23:33 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=76349#p76349</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK : Два процесса в из одного файла?]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=76347#p76347</link>
			<description><![CDATA[<p>Что-то я пока не понял как должен работать код из 11. Из *.ahk запускается два скрипта, а после компиляции и запуска *.exe, в диспетчере только один процесс видно, да и тот потом исчезает.</p>]]></description>
			<author><![CDATA[null@example.com (Next)]]></author>
			<pubDate>Tue, 22 Oct 2013 19:15:09 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=76347#p76347</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK : Два процесса в из одного файла?]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=76345#p76345</link>
			<description><![CDATA[<p>Может запускать разные подпрограммы, в зависимости от параметров командной строки? Тогда число различных процессов, которые можно запустить из одного скомпилированного скрипта неограничено.</p>]]></description>
			<author><![CDATA[null@example.com (ypppu)]]></author>
			<pubDate>Tue, 22 Oct 2013 18:26:33 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=76345#p76345</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK : Два процесса в из одного файла?]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=76344#p76344</link>
			<description><![CDATA[<p>В посте #9 указана подходящая методика<br /></p><div class="codebox"><pre><code>#SingleInstance off
if 1 = twice
   proc2()
else {
   Run, %A_ScriptFullPath% twice
   proc1()
}
Return

proc1()
{
   MsgBox Первый!
}

proc2()
{
   MsgBox Второй!
}</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (Irbis)]]></author>
			<pubDate>Tue, 22 Oct 2013 18:19:16 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=76344#p76344</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK : Два процесса в из одного файла?]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=76343#p76343</link>
			<description><![CDATA[<div class="quotebox"><cite>ypppu пишет:</cite><blockquote><p>Нужно из одного файла запустить два независимых разных процесса или два независимых одинаковых процесса?</p></blockquote></div><p>&nbsp; Разных.</p>]]></description>
			<author><![CDATA[null@example.com (Next)]]></author>
			<pubDate>Tue, 22 Oct 2013 17:50:06 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=76343#p76343</guid>
		</item>
	</channel>
</rss>
