<?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=12337&amp;type=atom" />
	<updated>2017-04-29T12:53:42Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=12337</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Пауза скрипта со сменой иконки в области уведомлений]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=115468#p115468" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>teadrinker пишет:</cite><blockquote><p>Вот так поставит на паузу сам себя через 5 секунд:</p></blockquote></div><p>Интересно, но данный способ подошел. Благодарю за помощь.</p>]]></content>
			<author>
				<name><![CDATA[slavafedora]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=34221</uri>
			</author>
			<updated>2017-04-29T12:53:42Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=115468#p115468</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Пауза скрипта со сменой иконки в области уведомлений]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=115432#p115432" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>slavafedora пишет:</cite><blockquote><p>Потому-что я пытаюсь добавить не по горячей клавише, а по таймеру.</p></blockquote></div><p>Всё равно непонятно, зачем нужна дополнительная функция. По таймеру сразу и вызывайте PauseFunc().</p><div class="quotebox"><cite>slavafedora пишет:</cite><blockquote><p>PauseFunc() так же работает некорректно</p></blockquote></div><p>Ну я уж не знаю, у вас там ещё какие-то функции, которые непонятно что делают.<br />Вот так поставит на паузу сам себя через 5 секунд:<br /></p><div class="codebox"><pre><code>Menu, Tray, Icon, pla.ico,1,1
OnMessage(0x111, &quot;WM_COMMAND&quot;)
SetTimer, TimeIdle
Return

TimeIdle:
   if A_TimeIdle &gt; 5000
      PauseFunc(true)
   Return

sc48:: PauseFunc(true)   ; Numpad8

PauseFunc(speak = false)  {
   static pause
   Menu, Tray, Icon, % (pause := !pause) ? &quot;paus.ico&quot; : &quot;pla.ico&quot;,1,1
   Pause, toggle, 1
   if speak  {
      Voice := ComObjCreate(&quot;SAPI.SpVoice&quot;)
      Voice.Speak(pause ? &quot;pause&quot; : &quot;start&quot;)
   }
   Return true
}

WM_COMMAND(wp)  {
   if (wp = 65306)
      Return PauseFunc()
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2017-04-28T16:39:01Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=115432#p115432</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Пауза скрипта со сменой иконки в области уведомлений]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=115431#p115431" />
			<content type="html"><![CDATA[<p><strong>teadrinker</strong><br />Потому-что я пытаюсь добавить не по горячей клавише, а по таймеру. Где будет переход на метку, но он там не работает. Поэтому сделал через функцию.<br />PauseFunc() так же работает некорректно, иконка в области с оповещениями начинает перемешиваться и выдавать разный результат. Я так и не понял в чем проблема.</p>]]></content>
			<author>
				<name><![CDATA[slavafedora]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=34221</uri>
			</author>
			<updated>2017-04-28T16:22:29Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=115431#p115431</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Пауза скрипта со сменой иконки в области уведомлений]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=115430#p115430" />
			<content type="html"><![CDATA[<p>А зачем вообще нужна эта функция Funck()? Почему по горячей клавише нельзя сразу вызвать PauseFunc()?</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2017-04-28T16:14:55Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=115430#p115430</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Пауза скрипта со сменой иконки в области уведомлений]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=115429#p115429" />
			<content type="html"><![CDATA[<p>Может просто возможно добавить данный счетчик прямо в функцию паузы.</p>]]></content>
			<author>
				<name><![CDATA[slavafedora]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=34221</uri>
			</author>
			<updated>2017-04-28T16:07:42Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=115429#p115429</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Пауза скрипта со сменой иконки в области уведомлений]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=115418#p115418" />
			<content type="html"><![CDATA[<p>И снова подниму данный вопрос, так как появился новый вопрос.<br />Уже обдумал всё что можно, не могу найти правильное решение, прошу Вашей помощи.</p><p>В общем, использую данную функцию в скрипте, что-бы ставить его на паузу и продолжать его работы(снять с паузы):<br /></p><div class="codebox"><pre><code>
^sc48::
Funck()
{
	PauseFunc(true) ; Пауза/Запуск Ctrl + Numpad8
}
return

PauseFunc(speak = false)  
{
   static pause
   Menu, Tray, Icon, % (pause := !pause) ? &quot;paus.ico&quot; Add1() : &quot;pla.ico&quot; Add(),1,1
   Pause, toggle, 1
   if speak  
   {
	   Voice := ComObjCreate(&quot;SAPI.SpVoice&quot;)
	   Voice.Speak(pause ? &quot;Пауза&quot; : &quot;Запуск&quot;)
	   addChatMessageEx(&quot;FFD700&quot;, pause ? &quot;{FFD700}Пауза&quot; : &quot;{FFD700}Запуск&quot;)
   }
   Return true
}

WM_COMMAND(wp)  {
   if (wp = 65306)
      Return PauseFunc()
}

Add()
{
    ScriptFileName := &quot;Pause.ahk&quot;
    SetTitleMatchMode, 2
    DetectHiddenWindows, On
    WinClose, % ScriptFileName &quot; ahk_class AutoHotkey&quot;
	return
}

Add1()
{
    run, *runas D:\Гта\Ахк\Рабочие\Pause.ahk
	return
}
</code></pre></div><p>Добавил в этот же скрипт ожидание активности пользователя и по истечению определенного времени, возможность использования данной функции постановки скрипта на паузу. Проще говоря, когда забыл отключить и ушел по своим делать, что бы в течении 1 минуты скрипт сам поставил себя на паузу. <br />Но что-то работает не так когда использую Funck(). Функция начинает просто бушевать и криво работать.<br /></p><div class="codebox"><pre><code>
If (A_TimeIdlePhysical &gt; 60 * 1000){
		Funck()
		return
	}
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[slavafedora]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=34221</uri>
			</author>
			<updated>2017-04-28T13:30:00Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=115418#p115418</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Пауза скрипта со сменой иконки в области уведомлений]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=112277#p112277" />
			<content type="html"><![CDATA[<p><strong>svoboden</strong><br />Работает, то что нужно! Спасибо. <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /></p>]]></content>
			<author>
				<name><![CDATA[slavafedora]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=34221</uri>
			</author>
			<updated>2017-02-12T13:57:19Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=112277#p112277</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Пауза скрипта со сменой иконки в области уведомлений]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=112275#p112275" />
			<content type="html"><![CDATA[<p>Так работает?:<br /></p><div class="codebox"><pre><code>^sc48:: PauseFunc(true)   ; Пауза/Запуск Ctrl + Numpad8

PauseFunc(speak = false)  {
   static pause
   Menu, Tray, Icon, % (pause := !pause) ? &quot;paus.ico&quot; Add1() : &quot;pla.ico&quot; Add(),1,1
   Pause, toggle, 1
   if speak  {
   Voice := ComObjCreate(&quot;SAPI.SpVoice&quot;)
   Voice.Speak(pause ? &quot;Пауза&quot; : &quot;Запуск&quot;)
   addChatMessageEx(&quot;FFD700&quot;, pause ? &quot;{FFD700}Пауза&quot; : &quot;{FFD700}Запуск&quot;)
   }
   Return true
   }

WM_COMMAND(wp)  {
   if (wp = 65306)
   Return PauseFunc()
   }

Add() {
    ScriptFileName := &quot;rty.ahk&quot;
    SetTitleMatchMode, 2
    DetectHiddenWindows, On
    WinClose, % ScriptFileName &quot; ahk_class AutoHotkey&quot;
    }
   Return

Add1() {
    run, *runas D:\Гта\Ахк\Рабочие\Pause.ahk
    }
   Return</code></pre></div>]]></content>
			<author>
				<name><![CDATA[svoboden]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=34280</uri>
			</author>
			<updated>2017-02-12T13:44:46Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=112275#p112275</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Пауза скрипта со сменой иконки в области уведомлений]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=112274#p112274" />
			<content type="html"><![CDATA[<p><strong>ypppu</strong><br />Исправил. Буду знать что и после смайлов тоже нужны.</p>]]></content>
			<author>
				<name><![CDATA[slavafedora]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=34221</uri>
			</author>
			<updated>2017-02-12T13:39:46Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=112274#p112274</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Пауза скрипта со сменой иконки в области уведомлений]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=112272#p112272" />
			<content type="html"><![CDATA[<p>Думаю, так: &quot;пишешь свои функции и добавляешь их сюда, Menu, Tray, Icon, % (pause := !pause) ? &quot;paus.ico&quot; Add() : &quot;pla.ico&quot;,1,1 Add1()&quot;.</p>]]></content>
			<author>
				<name><![CDATA[svoboden]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=34280</uri>
			</author>
			<updated>2017-02-12T13:29:15Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=112272#p112272</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Пауза скрипта со сменой иконки в области уведомлений]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=112265#p112265" />
			<content type="html"><![CDATA[<p><span style="color: green"><strong>slavafedora</strong>, добавьте недостающие точки в конце предложений.</span><br /><a href="http://forum.script-coding.com/viewtopic.php?pid=108049#p108049">http://forum.script-coding.com/viewtopi … 49#p108049</a><br /><a href="http://forum.script-coding.com/viewtopic.php?pid=110801#p110801">http://forum.script-coding.com/viewtopi … 01#p110801</a><br /><a href="http://forum.script-coding.com/viewtopic.php?pid=111298#p111298">http://forum.script-coding.com/viewtopi … 98#p111298</a><br /><a href="http://forum.script-coding.com/viewtopic.php?pid=112021#p112021">http://forum.script-coding.com/viewtopi … 21#p112021</a><br /><a href="http://forum.script-coding.com/viewtopic.php?pid=112259#p112259">http://forum.script-coding.com/viewtopi … 59#p112259</a><br /><a href="http://forum.script-coding.com/viewtopic.php?pid=112262#p112262">http://forum.script-coding.com/viewtopi … 62#p112262</a></p>]]></content>
			<author>
				<name><![CDATA[ypppu]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=5974</uri>
			</author>
			<updated>2017-02-12T13:21:10Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=112265#p112265</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Пауза скрипта со сменой иконки в области уведомлений]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=112262#p112262" />
			<content type="html"><![CDATA[<p>Имея данный скрипт:<br /></p><div class="codebox"><pre><code>
^sc48:: PauseFunc(true)   ; Пауза/Запуск Ctrl + Numpad8

PauseFunc(speak = false)  {
   static pause
   Menu, Tray, Icon, % (pause := !pause) ? &quot;paus.ico&quot; : &quot;pla.ico&quot;,1,1
   Pause, toggle, 1
   if speak  {
   Voice := ComObjCreate(&quot;SAPI.SpVoice&quot;)
   Voice.Speak(pause ? &quot;Пауза&quot; : &quot;Запуск&quot;)
   addChatMessageEx(&quot;FFD700&quot;, pause ? &quot;{FFD700}Пауза&quot; : &quot;{FFD700}Запуск&quot;)
   }
   Return true
}

WM_COMMAND(wp)  {
   if (wp = 65306)
      Return PauseFunc()
}
</code></pre></div><p>Кто может подсказать что бы при нажатии &quot;паузы&quot; как по клавише так и в трее в ручную когда я ставлю на паузу. У меня запускался скрипт, через данную функцию:<br /></p><div class="codebox"><pre><code>
run, *runas D:\Гта\Ахк\Рабочие\Pause.ahk
</code></pre></div><p>А при нажатии запуска по клавише или так же через трей у меня просто завершало его процесс это функцией:<br /></p><div class="codebox"><pre><code>
    ScriptFileName := &quot;Pause.ahk&quot;   ; название файла целевого скрипта
	SetTitleMatchMode, 2
	DetectHiddenWindows, On
	WinClose, % ScriptFileName &quot; ahk_class AutoHotkey&quot;
</code></pre></div><p>Все это аналогично смене иконки в данном скрипте. Пауза запускает скрипт, запуск завершает его процесс.<br />Подскажите пожалуйста. <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /></p>]]></content>
			<author>
				<name><![CDATA[slavafedora]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=34221</uri>
			</author>
			<updated>2017-02-12T13:07:53Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=112262#p112262</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Пауза скрипта со сменой иконки в области уведомлений]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=111403#p111403" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>Menu, Tray, Icon, pla.ico,1,1
OnMessage(0x111, &quot;WM_COMMAND&quot;)
Return

sc48:: PauseFunc(true)   ; Numpad8

PauseFunc(speak = false)  {
   static pause
   Menu, Tray, Icon, % (pause := !pause) ? &quot;paus.ico&quot; : &quot;pla.ico&quot;,1,1
   Pause, toggle, 1
   if speak  {
      Voice := ComObjCreate(&quot;SAPI.SpVoice&quot;)
      Voice.Speak(pause ? &quot;pause&quot; : &quot;start&quot;)
   }
   Return true
}

WM_COMMAND(wp)  {
   if (wp = 65306)
      Return PauseFunc()
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2017-01-22T12:37:34Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=111403#p111403</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Пауза скрипта со сменой иконки в области уведомлений]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=111385#p111385" />
			<content type="html"><![CDATA[<p><strong>teadrinker</strong><br />Еще раз огромное спасибо! Взял второй вариант.<br />У меня Windows 8.1, с русским языком воспроизводит.<br />Но есть еще один не большой вопрос, как можно сделать тут исключение на то, когда включаешь паузу скрипта в ручную через трей, что-бы данный звук не воспроизводился. А только при нажатии sc48 (Num8)?</p>]]></content>
			<author>
				<name><![CDATA[slavafedora]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=34221</uri>
			</author>
			<updated>2017-01-22T05:11:08Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=111385#p111385</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Пауза скрипта со сменой иконки в области уведомлений]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=111382#p111382" />
			<content type="html"><![CDATA[<div class="quotebox"><blockquote><p>С русским языком SAPI.SpVoice не работает.</p></blockquote></div><p>На win8 и выше должен работать.<br />А на win7 так:<br /><a href="http://forum.script-coding.com/viewtopic.php?pid=105469#p105469">http://forum.script-coding.com/viewtopi … 69#p105469</a></p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2017-01-22T00:06:18Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=111382#p111382</id>
		</entry>
</feed>
