<?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=6302</link>
		<atom:link href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=6302&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «AHK: Если "событие", то "действие", иначе "закрыть"».]]></description>
		<lastBuildDate>Fri, 14 Oct 2011 20:44:12 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: AHK: Если "событие", то "действие", иначе "закрыть"]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=52484#p52484</link>
			<description><![CDATA[<p>да, чёта сложновато, лучше я своим способом буду пользоваться (запустить два скрипта)</p>]]></description>
			<author><![CDATA[null@example.com (Вася Пупкин)]]></author>
			<pubDate>Fri, 14 Oct 2011 20:44:12 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=52484#p52484</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Если "событие", то "действие", иначе "закрыть"]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=52475#p52475</link>
			<description><![CDATA[<div class="codebox"><pre><code>SetTimer, CheckNotepad, 1000
SetTimer, CheckPaint, 1000
Return
CheckNotepad:
   Counter1++
   If Counter1=10
   {
      MsgBox, 262192,, notepad not found, 1
      SetTimer, CheckNotepad, Off
      Counter1:=
      Gosub, Exit
   }
   Process, Exist, notepad.exe
   If ErrorLevel
   {
      SetTimer, CheckNotepad, Off
      MsgBox, 262208,, notepad found, 1
      WinActivate, ahk_class Notepad
   }
   Return
CheckPaint:
   Counter2++
   If Counter2=10
   {
      MsgBox, 262192,, paint not found, 1
      SetTimer, CheckPaint, Off
      Counter2:=
      Gosub, Exit
   }
   Process, Exist, mspaint.exe
   If ErrorLevel
   {
      SetTimer, CheckPaint, Off
      MsgBox, 262208,, paint found, 1
      WinActivate, ahk_class MSPaintApp
   }
   Return
Exit:
   If (!WinExist(&quot;ahk_class Notepad&quot;) And !WinExist(&quot;ahk_class MSPaintApp&quot;))
   {
      MsgBox, 262160,, notepad &amp; paint is not found
                   . `n      script now exit, 1
      ExitApp
   }
   Else
   {
      If !WinExist(&quot;ahk_class Notepad&quot;)
      {
         MsgBox, 4,, notepad not found, research?
         IfMsgBox, Yes
            SetTimer, CheckNotepad, 1000
         Else
            ExitApp
      }
      Else If !WinExist(&quot;ahk_class MSPaintApp&quot;)
      {
         MsgBox, 4,, paint not found, research?
         IfMsgBox, Yes
            SetTimer, CheckPaint, 1000
         Else
            ExitApp
      }
   }
   Return</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (Grey)]]></author>
			<pubDate>Fri, 14 Oct 2011 18:36:33 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=52475#p52475</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Если "событие", то "действие", иначе "закрыть"]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=52471#p52471</link>
			<description><![CDATA[<p>Скрипт1:<br /></p><div class="codebox"><pre><code>WinWait, Безымянный - Paint,, 10
If ErrorLevel
   ExitApp
Else
{
Msgbox, Выполнение какой либо функции
}</code></pre></div><p>Скрипт2:<br /></p><div class="codebox"><pre><code>WinWait, Безымянный - Блокнот,, 10
If ErrorLevel
   ExitApp
Else
{
Msgbox, Выполнение какой либо функции
}</code></pre></div><p>Давайте мне ещё немножко поможем.<br />Кароче сматрите:</p><p>Скрипт1: <br /><strong>Если</strong> Пейнт открылся<br /><strong>то</strong> Выполнение какой либо функции<br /><strong>Иначе</strong> Ожидание 10 секунд открытия пейнта, и в слчае неудачи: Закрыть скрипт</p><p>Скрипт2: <br /><strong>Если</strong> Блокнот открылся<br /><strong>то</strong> Выполнение какой либо функции<br /><strong>Иначе</strong> Ожидание 10 секунд открытия блокнота, и в слчае неудачи: Закрыть скрипт</p><p>Вопрос:<br />Как мне объединить их в один скрипт?<br />Щас я их просто запускаю вместе,<br />а я хотел бы что бы всё это было в одном ahk-файле,<br />и что бы скрипт работал.</p><p>Как вы поняли, наверно, мне нужно выполнить определённую функцию в зависимости от запущенного приложения, и закрыть скрипт, если это приложение не открылось определённое время.</p><p>Спасибо.</p>]]></description>
			<author><![CDATA[null@example.com (Вася Пупкин)]]></author>
			<pubDate>Fri, 14 Oct 2011 16:39:13 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=52471#p52471</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Если "событие", то "действие", иначе "закрыть"]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=52328#p52328</link>
			<description><![CDATA[<p>Ладно, пойдёт, спасибо!</p>]]></description>
			<author><![CDATA[null@example.com (Вася Пупкин)]]></author>
			<pubDate>Mon, 10 Oct 2011 03:10:19 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=52328#p52328</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Если "событие", то "действие", иначе "закрыть"]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=52323#p52323</link>
			<description><![CDATA[<div class="quotebox"><cite>Вася Пупкин пишет:</cite><blockquote><p>...можно это в твоём скрипте:<br /></p><div class="codebox"><pre><code>ahk_class Notepad</code></pre></div><p>заменить на...</p><p>Или куда мне сдесь добавить десятку (ожидание 10 секунд)</p></blockquote></div><div class="codebox"><pre><code>SetTitleMatchMode, 2
WinWait, Блокнот,, 10
...</code></pre></div><div class="quotebox"><cite>Вася Пупкин пишет:</cite><blockquote><p>...я не понимяю что такое <strong>ahk_class</strong>, и как с ним работать.</p></blockquote></div><p><a href="http://forum.script-coding.com/viewtopic.php?pid=50969#p50969">Тут</a> погляди.<br /></p><div class="codebox"><pre><code>#Persistent
SetTitleMatchMode, 2
SetTimer, CheckApp, 1000

CheckApp:
   Counter++
   If Counter=10
      ExitApp
   Process, Exist, notepad.exe
   If ErrorLevel
   {
      WinActivate, Блокнот
      Click, 177, 20
      SetTimer, CheckApp, Off
   }
;   TrayTip,, % Counter
   Return</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (Grey)]]></author>
			<pubDate>Sun, 09 Oct 2011 19:02:13 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=52323#p52323</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Если "событие", то "действие", иначе "закрыть"]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=52322#p52322</link>
			<description><![CDATA[<p>Прикольно, работает.</p><p>А как нибудь можно это в твоём скрипте:<br /></p><div class="codebox"><pre><code>ahk_class Notepad</code></pre></div><p>заменить на это:<br /></p><div class="codebox"><pre><code>WinWait, Безымянный - Блокнот, 
IfWinNotActive, Безымянный - Блокнот, , WinActivate, Безымянный - Блокнот, 
WinWaitActive, Безымянный - Блокнот,</code></pre></div><p>И что бы скрипт работал.<br />А то я не понимяю что такое <strong>ahk_class</strong>, и как с ним работать.</p><p>Или куда мне сдесь добавить десятку (ожидание 10 секунд):<br /></p><div class="codebox"><pre><code>WinWait, Безымянный - Блокнот, 
IfWinNotActive, Безымянный - Блокнот, , WinActivate, Безымянный - Блокнот, 
WinWaitActive, Безымянный - Блокнот,</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (Вася Пупкин)]]></author>
			<pubDate>Sun, 09 Oct 2011 17:33:27 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=52322#p52322</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Если "событие", то "действие", иначе "закрыть"]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=52320#p52320</link>
			<description><![CDATA[<div class="codebox"><pre><code>WinWait, ahk_class Notepad,, 10
If ErrorLevel
   ExitApp
Else
{
   WinActivate, ahk_class Notepad
   Click, 177, 20
}
Return</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (Grey)]]></author>
			<pubDate>Sun, 09 Oct 2011 16:32:32 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=52320#p52320</guid>
		</item>
		<item>
			<title><![CDATA[AHK: Если "событие", то "действие", иначе "закрыть"]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=52314#p52314</link>
			<description><![CDATA[<p>Примерная схема скрипта:<br /></p><div class="codebox"><pre><code>    Тело1 (Первая часть скрипта)
Скрипт ожидает определённое событие, и выполняется если это событие наступило.


    Тело2 (Вторая часть скрипта)
Скрипт закрывается (например через 10 секунд), если событие в &quot;Тело1&quot; не наступило.</code></pre></div><p>Пример скрипта:</p><div class="codebox"><pre><code>    
 ; Тело1
WinWait, Безымянный - Блокнот, 
IfWinNotActive, Безымянный - Блокнот, , WinActivate, Безымянный - Блокнот, 
WinWaitActive, Безымянный - Блокнот, 

MouseClick, left,  177,  20


 ; Тело2
Sleep, 10000
Process, Close, AutoHotkey.exe</code></pre></div><p>1) По сути мне нужно что бы эти две части скрипта запустились одновременно (Тело1 + Тело2). Обе части находятся в одном .ahk - файле (в одном скрипте).<br />2) Если это не возможно то мне нужно следующее:<br />	а) Скрипт ожидает определённое событие: <br />	ожидает открытия блокнота<br />	б) и выполняет действие, если это событие наступило:<br />	MouseClick, left,&nbsp; 177,&nbsp; 20<br />	в) Скрипт закрывается (например через 10 секунд), если это событие&nbsp; не наступило:<br />	Process, Close, AutoHotkey.exe</p><p>P.s. Я привёл пример не рабочего скрипта, у меня происходит закрытие скрипта после того как событие наступило, а мне надо организовать закрытие в случае, если событие не наступило.<br />P.s.2. Случай с блокнотом, приведён в качестве примера.</p><p>Спасибо.</p>]]></description>
			<author><![CDATA[null@example.com (Вася Пупкин)]]></author>
			<pubDate>Sun, 09 Oct 2011 04:14:43 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=52314#p52314</guid>
		</item>
	</channel>
</rss>
