<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: Реакция на закрытие окна taskmrg.exe]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=15129&amp;type=atom" />
	<updated>2020-01-16T11:35:31Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=15129</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Реакция на закрытие окна taskmrg.exe]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=137270#p137270" />
			<content type="html"><![CDATA[<p>С 0.5 работает.</p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2020-01-16T11:35:31Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=137270#p137270</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Реакция на закрытие окна taskmrg.exe]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=137267#p137267" />
			<content type="html"><![CDATA[<p>Да, лучше ждать закрытия окна, я просто хотел вспомнить мониторинг процессов. Если перестаёт, можно период проверки уменьшить здесь: Within 1, можно .5 поставить.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2020-01-16T07:14:58Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=137267#p137267</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Реакция на закрытие окна taskmrg.exe]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=137265#p137265" />
			<content type="html"><![CDATA[<p>Не проще ли?<br /></p><div class="codebox"><pre><code>WinWaitClose, ahk_exe taskmgr.exe
loop
   RunWait, taskmgr.exe</code></pre></div><p><strong>teadrinker</strong>, У меня на Win-10 твой код не работает.<br />Если при открытии сразу же окно закрывать, то первые 3-5 раз запускает заново, потом перестает.<br />Висит на <br /></p><div class="quotebox"><blockquote><p>005: Run,taskmgr.exe<br />006: } (124.97)</p></blockquote></div>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2020-01-16T02:46:13Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=137265#p137265</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Реакция на закрытие окна taskmrg.exe]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=137264#p137264" />
			<content type="html"><![CDATA[<p>teadrinker, ясно.<br />Спасибо.</p>]]></content>
			<author>
				<name><![CDATA[ОсиповаТатьяна]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=39847</uri>
			</author>
			<updated>2020-01-15T23:52:12Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=137264#p137264</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Реакция на закрытие окна taskmrg.exe]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=137258#p137258" />
			<content type="html"><![CDATA[<p>Попробуйте такой код:<br /></p><div class="codebox"><pre><code>#Persistent
PM := new ProcessMonitoring(, Func(&quot;OnTaskmgrClose&quot;), &quot;taskmgr.exe&quot;)

OnTaskmgrClose(name, PID, cmd) {
   Run, taskmgr.exe
}

class ProcessMonitoring
{
   __New(UserFuncOnCreate := &quot;&quot;, UserFuncOnDelete := &quot;&quot;, singleProcess := &quot;&quot;) {
      command := &quot;Within 1 Where TargetInstance ISA &#039;Win32_Process&#039;&quot;
               . (singleProcess ? &quot; And TargetInstance.Name = &#039;&quot; . singleProcess . &quot;&#039;&quot; : &quot;&quot;)
      this.WMI := ComObjGet(&quot;winmgmts:&quot;)
      if UserFuncOnCreate {
         this.createSink := ComObjCreate(&quot;WbemScripting.SWbemSink&quot;)
         ComObjConnect( this.createSink, new this.EventSink(UserFuncOnCreate) )
         this.WMI.ExecNotificationQueryAsync(this.createSink, &quot;select * from __InstanceCreationEvent &quot; . command)
      }
      if UserFuncOnDelete {
         this.deleteSink := ComObjCreate(&quot;WbemScripting.SWbemSink&quot;)
         ComObjConnect( this.deleteSink, new this.EventSink(UserFuncOnDelete) )
         this.WMI.ExecNotificationQueryAsync(this.deleteSink, &quot;select * from __InstanceDeletionEvent &quot; . command)
      }
   }
   
   class EventSink
   {
      __New(UserFunc) {
         this.UserFunc := UserFunc
      }
      
      OnObjectReady(params*) {
         Process := params[1].TargetInstance
         name := Process.Name
         PID := Process.ProcessID
         cmd := Process.CommandLine
         timer := this.UserFunc.Bind(name, PID, cmd)
         SetTimer, % timer, -10
      }
   }
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2020-01-14T21:49:04Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=137258#p137258</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Реакция на закрытие окна taskmrg.exe]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=137257#p137257" />
			<content type="html"><![CDATA[<p>Это такое условие, проверяющее существование окна. Окно можно идентифицировать разными способами. Почитайте в документации.</p>]]></content>
			<author>
				<name><![CDATA[ypppu]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=5974</uri>
			</author>
			<updated>2020-01-14T20:23:33Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=137257#p137257</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Реакция на закрытие окна taskmrg.exe]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=137256#p137256" />
			<content type="html"><![CDATA[<p>А как это скриптом сделать ?</p>]]></content>
			<author>
				<name><![CDATA[ОсиповаТатьяна]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=39847</uri>
			</author>
			<updated>2020-01-14T20:19:49Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=137256#p137256</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Реакция на закрытие окна taskmrg.exe]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=137255#p137255" />
			<content type="html"><![CDATA[<p>Можно проверять периодически командой <em>WinExist() / IfWin[Not]Exist</em>.</p>]]></content>
			<author>
				<name><![CDATA[ypppu]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=5974</uri>
			</author>
			<updated>2020-01-14T20:10:04Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=137255#p137255</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: Реакция на закрытие окна taskmrg.exe]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=137254#p137254" />
			<content type="html"><![CDATA[<p>Добрый вечер.<br />Помогите решить проблему.</p><p>Как скриптом AHK автоматически заново запустить процесс taskmrg.exe (окно диспетчера задач), если этот диспетчер задач будет кем-то случайно закрыт или будет закрыт по таймеру другой программой.<br />То есть если процесс taskmrg.exe - исчезнет, то как его автоматически запустить вновь - скриптом AHK, сидящим в трее ?</p>]]></content>
			<author>
				<name><![CDATA[ОсиповаТатьяна]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=39847</uri>
			</author>
			<updated>2020-01-14T18:55:52Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=137254#p137254</id>
		</entry>
</feed>
