teadrinker
Готово. Обновляется раз в секунду.
Пытаюсь добавить еще один курс (Биткоина) по аналогии.
Ошибка при компиляции:
Duplicate function definition.
Specifically: WebRequest(url, method := "GET", HeadersArray := "", body := "", ByRef error := "")
Вот код:
#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 := "https://www.cryptometer.io/data/binance/eth/usdt"
html := WebRequest(url,, {"Pragma": "no-cache", "Cache-Control": "no-cache, no-store"})
RegExMatch(html, "class=""lastprice"">\K[\d,.]+", Price1)
WebRequest(url, method := "GET", HeadersArray := "", body := "", ByRef error := "") {
Whr := ComObjCreate("WinHttp.WinHttpRequest.5.1")
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 := "HttpRequest error, status: " . status
Arr := Whr.responseBody
pData := NumGet(ComObjValue(arr) + 8 + A_PtrSize)
length := arr.MaxIndex() + 1
Return StrGet(pData, length, "UTF-8")
}
GuiControl,, Text2, % Price1
SetTimer, Price2, 1000
Price2:
url := "https://www.cryptometer.io/data/binance/eth/usdt"
html := WebRequest(url,, {"Pragma": "no-cache", "Cache-Control": "no-cache, no-store"})
RegExMatch(html, "class=""lastprice"">\K[\d,.]+", Price2)
WebRequest(url, method := "GET", HeadersArray := "", body := "", ByRef error := "") {
Whr := ComObjCreate("WinHttp.WinHttpRequest.5.1")
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 := "HttpRequest error, status: " . status
Arr := Whr.responseBody
pData := NumGet(ComObjValue(arr) + 8 + A_PtrSize)
length := arr.MaxIndex() + 1
Return StrGet(pData, length, "UTF-8")
}
GuiControl,, Text2, % Price2
В чем может быть проблема?