<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: Progress Bar]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=12244&amp;type=atom" />
	<updated>2016-12-23T10:56:04Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=12244</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Progress Bar]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=110069#p110069" />
			<content type="html"><![CDATA[<p><strong>becauseim</strong><br /></p><div class="codebox"><pre><code>period := 400
w := 50, h := 7
CreateProgress(w, h)
TimeoutAction := Func(&quot;TimeoutAction&quot;)
Return

RButton:: ShowProgress(period, TimeoutAction,  w)
Esc:: ExitApp
   
ShowProgress(time, TimeoutAction, w := &quot;&quot;)  {
   static start, timer
   (!start &amp;&amp; start := A_TickCount)
   if !timer  {
      CoordMode, Mouse
      MouseGetPos, X, Y
      GuiControl,, Progress, 0
      Gui, Show, % &quot;NA x&quot; X - w//2 &quot; y&quot; y + 15
      timer := Func(A_ThisFunc).Bind(time, TimeoutAction)
      SetTimer, % timer, 10
   }
   pos := Round((A_TickCount - start)/time*100)
   (pos &gt; 100 &amp;&amp; pos := 100)
   GuiControl,, Progress, % pos
   if (pos = 100)  || !GetKeyState(&quot;RButton&quot;, &quot;P&quot;)  {
      SetTimer,, Delete
      start := timer := &quot;&quot;
      Gui, Show, Hide
      (pos = 100 &amp;&amp; TimeoutAction.Call())
   }
}

CreateProgress(w, h)  {
   global Progress
   Gui, +ToolWindow -Caption +AlwaysOnTop
   Gui, Add, Progress, x0 y0 w%w% h%h% vProgress
   Gui, Show, Hide w%w% h%h%
}

TimeoutAction()  {
   MsgBox, Действие`, если время вышло
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2016-12-23T10:56:04Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=110069#p110069</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Progress Bar]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=110066#p110066" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Flasher пишет:</cite><blockquote><p>Чаще встречаешь тех, кто хочет от него избавиться.</p></blockquote></div><p>В ТС для меня он действительно ни к чему. Впрочем, как и сам вызов контекстного меню при удержании ПКМ. А в других случаях было бы интересно иметь миниатюрный прогресс-бар, привязанный к удержанию.</p>]]></content>
			<author>
				<name><![CDATA[becauseim]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=33149</uri>
			</author>
			<updated>2016-12-23T09:22:49Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=110066#p110066</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Progress Bar]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=110056#p110056" />
			<content type="html"><![CDATA[<p>Еще, чтобы в минус не ушел отсчет, можно так:</p><div class="codebox"><pre><code>Number := 10
Gui, Font, s15
Gui, Add, Text, vText1, 111111111
GuiControl,,Text1, 10
Gui, Add, Progress, vProgress1 w500 h50 -Smooth Range0-500
Gui, Show

SetTimer, Progress2, 1000
ProgressBar(&quot;Progress1&quot;, Number, 1000)
return

Progress2:
Number -= 1
qw := Number &gt; 0 ? Number : 0
GuiControl,, Text1, %qw%
Return

ProgressBar(sBar, tTime, iRange)
{
	tTime := (tTime * 130)
	iSpeed := iRange / tTime
	iWay := 0 ; WriteDebug(1, &quot;Start&quot;)
	While(1)
	{
		Sleep 1
		GuiControl,, %sBar%,% iWay
		iWay += iSpeed
		If(iWay &gt; iRange)
			break
        ; WriteDebug(1, &quot;End&quot;)

	}
	
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[svoboden]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=34280</uri>
			</author>
			<updated>2016-12-22T23:41:57Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=110056#p110056</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Progress Bar]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=110055#p110055" />
			<content type="html"><![CDATA[<p><strong>stealzy</strong><br />При <a href="http://pasted.co/b98470ad">таких числах</a> нет проблем.</p>]]></content>
			<author>
				<name><![CDATA[Flasher]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27593</uri>
			</author>
			<updated>2016-12-22T21:51:46Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=110055#p110055</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Progress Bar]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=110054#p110054" />
			<content type="html"><![CDATA[<p>Здрасьте, команды то не мгновенно исполняются.<br />Используйте A_TimeIdle, на старте функции записывайте ее значение, а в цикле вычисляйте разницу.</p>]]></content>
			<author>
				<name><![CDATA[stealzy]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=31937</uri>
			</author>
			<updated>2016-12-22T21:47:57Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=110054#p110054</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Progress Bar]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=110053#p110053" />
			<content type="html"><![CDATA[<p><strong>becauseim</strong><br />Чаще встречаешь тех, кто хочет от него избавиться. Впрочем, это опциональная вещь.</p>]]></content>
			<author>
				<name><![CDATA[Flasher]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27593</uri>
			</author>
			<updated>2016-12-22T20:37:25Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=110053#p110053</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Progress Bar]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=110052#p110052" />
			<content type="html"><![CDATA[<p>Смежный вопрос. Существует ли сценарий, который добавляет к курсору маленький прогресс-бар для отображения необходимой длительности удержания ПКМ, как это реализовано в TotalCommander?<br />Иными словами, добавить к действию на удержание ПКМ на полторы секунды маленький прогресс-бар рядом с курсором.</p>]]></content>
			<author>
				<name><![CDATA[becauseim]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=33149</uri>
			</author>
			<updated>2016-12-22T20:31:24Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=110052#p110052</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: Progress Bar]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=110009#p110009" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>Number := 10
Gui, Font, s15
Gui, Add, Text, vText1, 111111111
GuiControl,,Text1, 10
Gui, Add, Progress, vProgress1 w500 h100 -Smooth Range0-500
Gui, Show

SetTimer, Progress2, 1000
ProgressBar(&quot;Progress1&quot;, Number, 500)
return

Progress2:
Number -= 1
GuiControl,, Text1,% Number
Return

ProgressBar(sBar, tTime, iRange)
{
	tTime := (tTime * 100)
	iSpeed := iRange / tTime
	iWay := 0
	;WriteDebug(1, &quot;Start&quot;)
	While(1)
	{
		Sleep 1
		GuiControl,, %sBar%,% iWay
		iWay += iSpeed
		If(iWay &gt; iRange)
			break
	}
	;WriteDebug(1, &quot;End&quot;)

}</code></pre></div><p>Погрешность в 5 секунд. Помогите исправить.</p>]]></content>
			<author>
				<name><![CDATA[MandarinKa02]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=34409</uri>
			</author>
			<updated>2016-12-22T12:24:50Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=110009#p110009</id>
		</entry>
</feed>
