<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Серый форум &mdash; AHK: автообновление gui]]></title>
		<link>https://forum.script-coding.com/viewtopic.php?id=17127</link>
		<atom:link href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=17127&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «AHK: автообновление gui».]]></description>
		<lastBuildDate>Mon, 16 May 2022 20:45:58 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: AHK: автообновление gui]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=153229#p153229</link>
			<description><![CDATA[<p>Тут правда в строке &#039;UnixTimeToLocal(Time, -5, &quot;hh:mm:ss&quot;)&#039; необходимо подставить своё значение часового смещения вместо &#039;-5&#039;.</p>]]></description>
			<author><![CDATA[null@example.com (__Михаил__)]]></author>
			<pubDate>Mon, 16 May 2022 20:45:58 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=153229#p153229</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: автообновление gui]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=153228#p153228</link>
			<description><![CDATA[<p><strong>__Михаил__</strong> , благодарю, снова меня выручаете.</p>]]></description>
			<author><![CDATA[null@example.com (yura170100)]]></author>
			<pubDate>Mon, 16 May 2022 20:03:17 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=153228#p153228</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: автообновление gui]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=153227#p153227</link>
			<description><![CDATA[<div class="codebox"><pre><code>CustomColor2 = EEAA99

Gui +LastFound +AlwaysOnTop -Caption +ToolWindow
Gui, Color, 0
Gui, Font, s7 w4300
Gui, Add, Text, cWhite, Время:
Gui, Add, Text, cWhite vTT x5 y24, Загрузка
Gui, Show, x5 y10 NA

WinSet, TransColor, %CustomColor2% 200
Winset, ExStyle, +0x20
SetTimer, GetTime, 1000
Return


UGet(U){
 E := ComObjCreate(&quot;WinHTTP.WinHTTPRequest.5.1&quot;), E.Open(&quot;GET&quot;,u), E.Send(), E.WaitForResponse(), R:=E.ResponseText, E=
 Return R
}

GetTime(){
 Static Time := UGet(&quot;https://time100.ru/api.php&quot;)
 GuiControl,, TT, % UnixTimeToLocal(Time, -5, &quot;hh:mm:ss&quot;)
 Time++
}

UnixTimeToLocal(UnixTime, Diff := 0, FormatStr := &quot;&quot;){
 Time := &quot;19700101&quot;
 Time += UnixTime, s
 Time += Diff, h
 If FormatStr
  FormatTime, Time, % Time, % FormatStr
 Return Time
}</code></pre></div><p>Мой вариант загружает с сайта один раз, обновляет время без цикла. Лишнее удалил.</p>]]></description>
			<author><![CDATA[null@example.com (__Михаил__)]]></author>
			<pubDate>Mon, 16 May 2022 19:03:35 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=153227#p153227</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: автообновление gui]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=153226#p153226</link>
			<description><![CDATA[<p>&#039;GuiControl&#039; для этого есть.</p>]]></description>
			<author><![CDATA[null@example.com (__Михаил__)]]></author>
			<pubDate>Mon, 16 May 2022 18:23:18 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=153226#p153226</guid>
		</item>
		<item>
			<title><![CDATA[AHK: автообновление gui]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=153225#p153225</link>
			<description><![CDATA[<p>Добрый день. Имеется ahk, которая ретранслирует время с сайта <a href="http:////time100.ru/">Time100</a> через gui. Обновление времени должно происходить каждую секунду, смог реализовать только через цикл, в начале которого gui открывается, а в конце закрывается. Возможны ли какие-то варианты, чтобы gui обновлялся без постоянного закрытия и открытия?<br />Код:<br /></p><div class="codebox"><pre><code>

GetTimeFromTime100ru(localTimeOffset := 0, formatString := &quot;&quot;) {
   static url := &quot;https://time100.ru/api.php&quot;
   unixTime := GetResponseText(url,,,, error)
   if error
      throw error
   Return UnixTimeToLocal(unixTime, localTimeOffset, formatString)
}

GetResponseText(url, method := &quot;GET&quot;, HeadersArray := &quot;&quot;, body := &quot;&quot;, ByRef error := &quot;&quot;) {
   Whr := ComObjCreate(&quot;WinHttp.WinHttpRequest.5.1&quot;)
   Whr.Open(method, url, true)
   for name, value in HeadersArray
      Whr.SetRequestHeader(name, value)
   Whr.Send(body)
   Whr.WaitForResponse()
   status := Whr.status
   if (status != 200)
      error := &quot;HttpRequest error, status: &quot; . status
   Arr := Whr.responseBody
   pData := NumGet(ComObjValue(arr) + 8 + A_PtrSize)
   length := arr.MaxIndex() + 1
   Return StrGet(pData, length, &quot;UTF-8&quot;)
}

UnixTimeToLocal(unixTime, diff, formatStr := &quot;&quot;) {
   time := &quot;19700101&quot;
   time += unixTime, s
   time += diff, h
   if formatStr
      FormatTime, time, % time, % formatStr
   Return time
}
Loop
{
DllCall(&quot;ShowCursor&quot;, UInt, 0)
CustomColor2 = EEAA99

Gui +LastFound +AlwaysOnTop -Caption +ToolWindow +Disabled
GuiControl, Disable, Tab
Gui, Color, black

Gui, Font, s7

Gui, Font, cWhite

Gui, Font, w4300

GUI, ADD, TEXT,,      Time100
GUI, ADD, TEXT,,      % GetTimeFromTime100ru(3, &quot;HH:mm:ss&quot;)

WinSet, TransColor, %CustomColor2% 200
Winset, ExStyle, +0x20
Gui, Show, NoActivate x5 y10, My Window
Sleep, 100
Gui Destroy

}
!2::
reload
</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (yura170100)]]></author>
			<pubDate>Mon, 16 May 2022 18:18:45 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=153225#p153225</guid>
		</item>
	</channel>
</rss>
