<?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=7772&amp;type=atom" />
	<updated>2012-11-13T14:16:04Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=7772</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Вычисление]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=65588#p65588" />
			<content type="html"><![CDATA[<p>Парадигма «корабль в бутылке» <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /></p>]]></content>
			<author>
				<name><![CDATA[creature.ws]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26105</uri>
			</author>
			<updated>2012-11-13T14:16:04Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=65588#p65588</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Вычисление]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=65585#p65585" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>creature.ws пишет:</cite><blockquote><p>В ваших набросках,&nbsp; в фрагменте:<br /></p><div class="codebox"><pre><code>      SetTimer, lGeneralTimer, off
      Updatetimers(0)
      numbertime := 0</code></pre></div><p>В чём предназначение второй строки? «Не силён» не объясняет, что вы ожидали получить, написав эту строку.</p></blockquote></div><p>Ожидал помощи от опытных в этом деле людей, данный код был составлен опираясь на коды сторонних скриптов с похожей направленностью <img src="//forum.script-coding.com/img/smilies/neutral.png" width="15" height="15" /></p>]]></content>
			<author>
				<name><![CDATA[Uniors]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=28904</uri>
			</author>
			<updated>2012-11-13T13:56:38Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=65585#p65585</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Вычисление]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=65582#p65582" />
			<content type="html"><![CDATA[<p>В ваших набросках,&nbsp; в фрагменте:<br /></p><div class="codebox"><pre><code>      SetTimer, lGeneralTimer, off
      Updatetimers(0)
      numbertime := 0</code></pre></div><p>В чём предназначение второй строки? «Не силён» не объясняет, что вы ожидали получить, написав эту строку.</p>]]></content>
			<author>
				<name><![CDATA[creature.ws]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26105</uri>
			</author>
			<updated>2012-11-13T12:08:00Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=65582#p65582</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Вычисление]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=65581#p65581" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Александр_ пишет:</cite><blockquote><p>1. Что за функция <strong>Updatetimers</strong>? Она вызывается, но нигде не объявлена.<br />2. <strong>numbertime</strong> это функция или переменная?</p></blockquote></div><p>В программировании не силен, мои первый наброски.<br />Каждому радио (голочке) присвоена фиксированная единица времени (3600сек/7200с/18000с...) в зависимости от активного радио должен запуститься таймер с указанным временем</p>]]></content>
			<author>
				<name><![CDATA[Uniors]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=28904</uri>
			</author>
			<updated>2012-11-13T11:50:58Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=65581#p65581</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Вычисление]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=65580#p65580" />
			<content type="html"><![CDATA[<p>1. Что за функция <strong>Updatetimers</strong>? Она вызывается, но нигде не объявлена.<br />2. <strong>numbertime</strong> это функция или переменная?</p>]]></content>
			<author>
				<name><![CDATA[Александр_]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24888</uri>
			</author>
			<updated>2012-11-13T11:43:13Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=65580#p65580</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Вычисление]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=65579#p65579" />
			<content type="html"><![CDATA[<p>Ходячая катастрофа <img src="//forum.script-coding.com/img/smilies/big_smile.png" width="15" height="15" /> , нужно запустить таймер с фиксированной единицой в зависимости от выбранной галочки (радио) по нажатию на кнопку Старт, с учетом формата выводимого времени &quot;Часы:Минуты:Секунды&quot;.<br /></p><div class="codebox"><pre><code>#SingleInstance force
Gui,Add, Text, x70 y30 w100 h25 vtimers, X_X
Gui,Add, Radio ,x15 y30 gtimes vtimestyle1, 1ч
Gui,Add, Radio ,x+10 y30 gtimes vtimestyle2, 2ч
Gui,Add, Radio ,x+10 y30 gtimes vtimestyle3, 5ч
Gui,Add, Radio ,x+10 y30 gtimes vtimestyle4, 8ч
Gui,Add, Text, x85 y55 h25 gstart, Старт
Gui,Show, w180 h80
return

times:
Gui, Submit, NoHide
If timestyle1=1
  numbertime:=3600 
If timestyle2=1
  numbertime:=7200
If timestyle3=1
  numbertime:=18000
If timestyle4=1
  numbertime:=28800
return

 
numbertime(Num)
{
   Hours := Num // 3600
   Num := Mod(Num, 3600)
   Min := Num // 60
   Sec := Mod(Num, 60)
   return Hours &quot; часов, &quot; Min &quot; минут и &quot; Sec &quot; секунд&quot;
}

start:
if(numbertime!=0)
   {
      SetTimer, lGeneralTimer, off
      SetTimer, lUpdateTimer, off
   }
   StartTime := A_TickCount
   SetTimer, lUpdateTimer, 1000
return

 
UpdateDisplay(numbertime)
{
   GuiControl, Text, timers, % NumToTime
}
 
lGeneralTimer:
   SetTimer, lGeneralTimer, off
TrayTip, Внимание!, Таймер завершен, 5, 1
return
 
lUpdateTimer:
   if(StartTime+randbot*1000&lt;=A_TickCount)
   {
      SetTimer, lGeneralTimer, off
      Updatetimers(0)
      numbertime := 0
   }
   else
      UpdateDisplay(numbertime-(A_TickCount-StartTime)//1000)
return

End::ExitApp</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Uniors]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=28904</uri>
			</author>
			<updated>2012-11-13T10:33:51Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=65579#p65579</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Вычисление]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=65570#p65570" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Uniors пишет:</cite><blockquote><p>Так точно</p></blockquote></div><p>Тогда в чём проблема? Дальше только математика- выделяем секунды(<strong>Mod(Time, 60)</strong>, т.е. остаток от деления на 60), минуты (<strong>Mod(Time//60, 60)</strong>, целочисленное деление на 60, чтобы отбросить секунды, и остаток от деления на 60 получившегося значения) и часы/сутки по аналогии.</p>]]></content>
			<author>
				<name><![CDATA[Александр_]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24888</uri>
			</author>
			<updated>2012-11-12T19:21:41Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=65570#p65570</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Вычисление]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=65569#p65569" />
			<content type="html"><![CDATA[<p>Так точно</p>]]></content>
			<author>
				<name><![CDATA[Uniors]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=28904</uri>
			</author>
			<updated>2012-11-12T19:12:30Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=65569#p65569</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Вычисление]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=65568#p65568" />
			<content type="html"><![CDATA[<p>А теперь вместо слова &quot;секунды&quot; вывести количество секунд?</p>]]></content>
			<author>
				<name><![CDATA[Александр_]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24888</uri>
			</author>
			<updated>2012-11-12T19:09:34Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=65568#p65568</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Вычисление]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=65567#p65567" />
			<content type="html"><![CDATA[<p>Теоретически возможно<br /></p><div class="codebox"><pre><code>Gui,Add, Text, x15 y27 , Часы
Gui,Add, Text, x15 y47 , минуты
Gui,Add, Text, x15 y67 , секунды</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Uniors]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=28904</uri>
			</author>
			<updated>2012-11-12T18:48:41Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=65567#p65567</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Вычисление]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=65566#p65566" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Uniors пишет:</cite><blockquote><p>Возможно ли отображать минуты и секунды в разных местах окна?<br />часы х+30 Минуты х+30 секунды</p></blockquote></div><p>Ты можешь в тех местах вывести фиксированный текст(например &quot;H&quot; вместо часов и &quot;M&quot; вместо минут)?</p>]]></content>
			<author>
				<name><![CDATA[Александр_]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24888</uri>
			</author>
			<updated>2012-11-12T18:42:20Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=65566#p65566</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Вычисление]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=65565#p65565" />
			<content type="html"><![CDATA[<p>Возможно ли отображать минуты и секунды в разных местах окна?<br />часы х+30 Минуты х+30 секунды</p>]]></content>
			<author>
				<name><![CDATA[Uniors]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=28904</uri>
			</author>
			<updated>2012-11-12T18:38:55Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=65565#p65565</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Вычисление]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=65563#p65563" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>#SingleInstance force
Gui,Font, S9 w700 CRed, Courier new
Gui,Add, Text, x80 y35 h15  gstart, Старт
Gui,Add, Text, x20 y70 h15 vDisplay, % NumToTime(randbot)
Gui,Show
return

NumToTime(Num)
{
   Hours := Num // 3600
   Num := Mod(Num, 3600)
   Min := Num // 60
   Sec := Mod(Num, 60)
   return Hours &quot; часов, &quot; Min &quot; минут и &quot; Sec &quot; секунд     &quot;
}
return

UpdateDisplay:
GuiControl, Text, Display, % NumToTime(randbot)
if randbot
randbot--
else 
{
MsgBox Таймер = 0
ExitApp
}
return

start:
Random, randbot , 7000, 9000
SetTimer, UpdateDisplay, 1000
return
 
GuiClose:
End::ExitApp</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Irbis]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27384</uri>
			</author>
			<updated>2012-11-12T15:12:04Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=65563#p65563</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Вычисление]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=65562#p65562" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>Gui,Add, Text, w75 vDisplay
Gui,Add, Button, w75 glStart, Старт
Gui,Show
return

NumToTime(Num)
{
   if(Num&lt;0)
      Num := 0
   Hours := Num // 3600
   Num := Mod(Num, 3600)
   Min := Num // 60
   Sec := Mod(Num, 60)
   return (Hours&gt;=10?Hours:(&quot;0&quot; Hours)) &quot; : &quot; (Min&gt;=10?Min:(&quot;0&quot; Min)) &quot; : &quot; (Sec&gt;=10?Sec:(&quot;0&quot; Sec))
}

CreateTimer()
{
   Random, randbot, 10, 20
   SetTimer, lGeneralTimer, % randbot*1000
   UpdateDisplay(randbot)
   return randbot
}

UpdateDisplay(randbot)
{
   GuiControl, Text, Display, % NumToTime(randbot)
}

lGeneralTimer:
   msgbox бум!
   SetTimer, lGeneralTimer, off
return

lUpdateTimer:
   if(StartTime+randbot*1000&lt;=A_TickCount)
   {
      SetTimer, lGeneralTimer, off
	  UpdateDisplay(0)
	  randbot := 0
   }
   else
      UpdateDisplay(randbot-(A_TickCount-StartTime)//1000)
return

lStart:
   if(randbot!=0)
   {
      SetTimer, lGeneralTimer, off
	  SetTimer, lUpdateTimer, off
   }
   StartTime := A_TickCount
   randbot := CreateTimer()
   SetTimer, lUpdateTimer, 1000
return

GuiClose:
End::ExitApp</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Александр_]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24888</uri>
			</author>
			<updated>2012-11-12T15:11:44Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=65562#p65562</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Вычисление]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=65559#p65559" />
			<content type="html"><![CDATA[<p>Вопрос решен частично, как запустить таймер из получившегося времени? <br /></p><div class="codebox"><pre><code>#SingleInstance force
Gui,Font, S9 w700 CRed, Courier new
Gui,Add, Text, x20 y70 h15 vDisplay, % NumToTime(randbot)
SetTimer, UpdateDisplay
Gui,Add, Text, x20 y40 h15  gstart, Старт
Gui,Show

NumToTime(Num)
{
   Hours := Num // 3600
   Num := Mod(Num, 3600)
   Min := Num // 60
   Sec := Mod(Num, 60)
   return Hours &quot; часов, &quot; Min &quot; минут и &quot; Sec &quot; секунд&quot;
}
return

UpdateDisplay:
GuiControl, Text, Display, % NumToTime(randbot)
return

start:
Random, randbot , 7000, 9000
return
 
End::ExitApp</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Uniors]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=28904</uri>
			</author>
			<updated>2012-11-12T14:22:29Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=65559#p65559</id>
		</entry>
</feed>
