<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: Виджет / GUI на рабочий стол, данные со страницы]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=16823&amp;type=atom" />
	<updated>2021-12-13T19:25:09Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=16823</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Виджет / GUI на рабочий стол, данные со страницы]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=151169#p151169" />
			<content type="html"><![CDATA[<p><strong>teadrinker</strong><br />Понял</p>]]></content>
			<author>
				<name><![CDATA[Michael]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=41356</uri>
			</author>
			<updated>2021-12-13T19:25:09Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=151169#p151169</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Виджет / GUI на рабочий стол, данные со страницы]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=151168#p151168" />
			<content type="html"><![CDATA[<p>Я понял, вы хотите в этой теме решить все вопросы, связанные с написанием скриптов на AHK. <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /> Вообще, программирование предполагает способность иногда думать и искать решения самостоятельно.<br />У нас есть <a href="https://forum.script-coding.com/rules.html#3.11.">правило</a>: одна тема — один вопрос.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2021-12-13T19:21:14Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=151168#p151168</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Виджет / GUI на рабочий стол, данные со страницы]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=151167#p151167" />
			<content type="html"><![CDATA[<p><strong>teadrinker</strong><br />Готово. Обновляется раз в секунду.<br />Пытаюсь добавить еще один курс (Биткоина) по аналогии.<br />Ошибка при компиляции:<br /></p><div class="codebox"><pre><code>Duplicate function definition.
Specifically: WebRequest(url, method := &quot;GET&quot;, HeadersArray := &quot;&quot;, body := &quot;&quot;, ByRef error := &quot;&quot;)</code></pre></div><p>Вот код:<br /></p><div class="codebox"><pre><code>#SingleInstance Force
#NoEnv
SetBatchLines -1

Name = Test

GroupAdd, AppGroup, % Name

Gui +AlwaysOnTop
;Gui Color, 0x000000
Gui Add, Text, vText1 x8 y8 w250 h60 +0x200, uuu
Gui Add, Text, vText2 x8 y58 w250 h60 +0x200,
Menu, Tray, NoIcon
Gui Show, w246 h365, % Name

SetTimer, Price1, 1000

Price1:
url := &quot;https://www.cryptometer.io/data/binance/eth/usdt&quot;

html := WebRequest(url,, {&quot;Pragma&quot;: &quot;no-cache&quot;, &quot;Cache-Control&quot;: &quot;no-cache, no-store&quot;})
RegExMatch(html, &quot;class=&quot;&quot;lastprice&quot;&quot;&gt;\K[\d,.]+&quot;, Price1)

WebRequest(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;)
}

GuiControl,, Text2, % Price1

SetTimer, Price2, 1000

Price2:
url := &quot;https://www.cryptometer.io/data/binance/eth/usdt&quot;

html := WebRequest(url,, {&quot;Pragma&quot;: &quot;no-cache&quot;, &quot;Cache-Control&quot;: &quot;no-cache, no-store&quot;})
RegExMatch(html, &quot;class=&quot;&quot;lastprice&quot;&quot;&gt;\K[\d,.]+&quot;, Price2)

WebRequest(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;)
}

GuiControl,, Text2, % Price2</code></pre></div><p>В чем может быть проблема?</p>]]></content>
			<author>
				<name><![CDATA[Michael]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=41356</uri>
			</author>
			<updated>2021-12-13T19:16:37Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=151167#p151167</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Виджет / GUI на рабочий стол, данные со страницы]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=151166#p151166" />
			<content type="html"><![CDATA[<p>Смотрите в сторону SetTimer. Но если сайт слишком часто долбить запросами, ему это может не понравиться.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2021-12-13T19:05:03Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=151166#p151166</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Виджет / GUI на рабочий стол, данные со страницы]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=151165#p151165" />
			<content type="html"><![CDATA[<p>Почитал, понял ошибку.<br />Показывает курс при старте программы:<br /></p><div class="codebox"><pre><code>#SingleInstance Force
#NoEnv
SetBatchLines -1

Name = Test

GroupAdd, AppGroup, % Name

Gui +AlwaysOnTop
;Gui Color, 0x000000
Gui Add, Text, vText x8 y8 w250 h60 +0x200,
Menu, Tray, NoIcon
Gui Show, w246 h365, % Name

Price:
url := &quot;https://www.cryptometer.io/data/binance/eth/usdt&quot;

html := WebRequest(url,, {&quot;Pragma&quot;: &quot;no-cache&quot;, &quot;Cache-Control&quot;: &quot;no-cache, no-store&quot;})
RegExMatch(html, &quot;class=&quot;&quot;lastprice&quot;&quot;&gt;\K[\d,.]+&quot;, Price)

WebRequest(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;)
}

GuiControl,, Text, % Price</code></pre></div><p>Только он статичный, запрос делается один раз, а как сделать ежесекундно (обновляемый автоматически)? Хотя бы в какую сторону копать?</p>]]></content>
			<author>
				<name><![CDATA[Michael]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=41356</uri>
			</author>
			<updated>2021-12-13T19:02:02Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=151165#p151165</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Виджет / GUI на рабочий стол, данные со страницы]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=151164#p151164" />
			<content type="html"><![CDATA[<p>Наверно, стоит почитать, что такое Return, и для чего оно нужно. А также ExitApp.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2021-12-13T18:56:21Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=151164#p151164</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Виджет / GUI на рабочий стол, данные со страницы]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=151163#p151163" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>teadrinker пишет:</cite><blockquote><p>А если убрать Return, тогда перестаёт появляться?</p></blockquote></div><p>Нет, всё также появляется, попробовал в своём скрипте без Return - никаких изменений...<br />Не пойму, как это связано.</p>]]></content>
			<author>
				<name><![CDATA[Michael]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=41356</uri>
			</author>
			<updated>2021-12-13T18:53:23Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=151163#p151163</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Виджет / GUI на рабочий стол, данные со страницы]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=151162#p151162" />
			<content type="html"><![CDATA[<p>Я в вас верю, вы способны пройти этот челлендж! <img src="//forum.script-coding.com/img/smilies/wink.png" width="15" height="15" /></p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2021-12-13T18:49:11Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=151162#p151162</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Виджет / GUI на рабочий стол, данные со страницы]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=151161#p151161" />
			<content type="html"><![CDATA[<p>А если убрать Return, тогда перестаёт появляться?</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2021-12-13T18:48:20Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=151161#p151161</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Виджет / GUI на рабочий стол, данные со страницы]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=151160#p151160" />
			<content type="html"><![CDATA[<p>Потому что добавил Return в конец. Что и сделал в моем скрипте...<br />Мне уже самому смешно, что мне такие вопросы задаете, чувствую себя умственно-отсталым...)))</p>]]></content>
			<author>
				<name><![CDATA[Michael]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=41356</uri>
			</author>
			<updated>2021-12-13T18:45:18Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=151160#p151160</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Виджет / GUI на рабочий стол, данные со страницы]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=151159#p151159" />
			<content type="html"><![CDATA[<p>А почему второе сообщение стало появляться?</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2021-12-13T18:39:43Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=151159#p151159</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Виджет / GUI на рабочий стол, данные со страницы]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=151158#p151158" />
			<content type="html"><![CDATA[<p><strong>teadrinker</strong><br /></p><div class="codebox"><pre><code>MsgBox, Вы увидите это сообщение

MsgBox, Это сообщение не появится, как думаете, почему?
Return</code></pre></div><p>Вот так я вижу сначала первое, потом второе.<br />В моем случае это почему-то не работает:<br /></p><div class="codebox"><pre><code>#SingleInstance Force
#NoEnv
SetBatchLines -1

Name = Test

GroupAdd, AppGroup, % Name

;Gui +AlwaysOnTop
;Gui Color, 0x000000
Gui Add, Text, vText x8 y8 w250 h60 +0x200, % Price
Menu, Tray, NoIcon

Gui Show, w246 h365, % Name
return

GuiClose:
ExitApp

Price:
url := &quot;https://www.cryptometer.io/data/binance/eth/usdt&quot;

html := WebRequest(url,, {&quot;Pragma&quot;: &quot;no-cache&quot;, &quot;Cache-Control&quot;: &quot;no-cache, no-store&quot;})
RegExMatch(html, &quot;class=&quot;&quot;lastprice&quot;&quot;&gt;\K[\d,.]+&quot;, Price)
GuiControl,, Text, % Price

;MsgBox, % Price

WebRequest(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;)
}
return</code></pre></div><p>Знаю, вокруг да около хожу, проблемы не вижу... Туплю...</p>]]></content>
			<author>
				<name><![CDATA[Michael]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=41356</uri>
			</author>
			<updated>2021-12-13T18:36:50Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=151158#p151158</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Виджет / GUI на рабочий стол, данные со страницы]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=151157#p151157" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Michael пишет:</cite><blockquote><p>Потому что нету Return.</p></blockquote></div><p>Уверены? А с return как будет?<br /></p><div class="codebox"><pre><code>MsgBox, Вы увидите это сообщение
Return

MsgBox, Это сообщение не появится, как думаете, почему?
Return</code></pre></div><p>Так?</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2021-12-13T18:31:46Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=151157#p151157</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Виджет / GUI на рабочий стол, данные со страницы]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=151156#p151156" />
			<content type="html"><![CDATA[<p><strong>teadrinker</strong><br />Потому что нету Return.<br />Но с ним тоже ничего не показывает:<br /></p><div class="codebox"><pre><code>#SingleInstance Force
#NoEnv
SetBatchLines -1

Name = Test

GroupAdd, AppGroup, % Name

;Gui +AlwaysOnTop
;Gui Color, 0x000000
Gui Add, Text, vText x8 y8 w250 h60 +0x200, % Price
Menu, Tray, NoIcon

Gui Show, w246 h365, % Name
Return

GuiClose:
ExitApp

Price:
url := &quot;https://www.cryptometer.io/data/binance/eth/usdt&quot;

html := WebRequest(url,, {&quot;Pragma&quot;: &quot;no-cache&quot;, &quot;Cache-Control&quot;: &quot;no-cache, no-store&quot;})
RegExMatch(html, &quot;class=&quot;&quot;lastprice&quot;&quot;&gt;\K[\d,.]+&quot;, Price)
GuiControl,, Text, % Price
return
;MsgBox, % Price

WebRequest(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;)
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Michael]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=41356</uri>
			</author>
			<updated>2021-12-13T18:29:15Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=151156#p151156</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Виджет / GUI на рабочий стол, данные со страницы]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=151155#p151155" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>MsgBox, Вы увидите это сообщение
Return

MsgBox, Это сообщение не появится, как думаете, почему?</code></pre></div>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2021-12-13T18:25:34Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=151155#p151155</id>
		</entry>
</feed>
