Orion9

Joined: 01 Jan 2024 Posts: 943
|
(Separately) Posted: Sat Nov 29, 2025 20:39 Post subject: |
|
|
Собственно, три универсальные функции. Код можно добавить в любой модуль.
 Hidden text | Code: | Func URLDownloadToFile(URL, FileName)
Local hr
hr = DllCall("Urlmon.dll\URLDownloadToFileW", _
"ptr", 0, "wstr", URL, "wstr", FileName, "dword", 0, "ptr", 0, "hresult")
Return hr
EndFunc
Func GetINetECode(nCode)
Local sCode
Switch nCode
Case 0x800C0002 # INET_E_INVALID_URL
sCode = "The URL could not be parsed."
Case 0x800C0003 # INET_E_NO_SESSION
sCode = "No Internet session was established."
Case 0x800C0004 # INET_E_CANNOT_CONNECT
sCode = "The attempt to connect to the Internet has failed."
Case 0x800C0005 # INET_E_RESOURCE_NOT_FOUND
sCode = "The Internet resource was not found."
Case 0x800C0007 # INET_E_DATA_NOT_AVAILABLE
sCode = "An Internet connection was established, but the data cannot be retrieved."
Case 0x800C0008 # INET_E_DOWNLOAD_FAILURE
sCode = "The download has failed (the connection was interrupted)."
Case 0x800C000B # INET_E_CONNECTION_TIMEOUT
sCode = "The Internet connection has timed out."
Case 0x800C000C # INET_E_INVALID_REQUEST
sCode = "The request was invalid."
Case 0x800C000D # INET_E_UNKNOWN_PROTOCOL
sCode = "The protocol is not known and no pluggable protocols have been entered that match."
Case 0x800C000E # INET_E_SECURITY_PROBLEM
sCode = "A security problem was encountered (certificate problems, client authentication, etc.)"
Case 0x800C0019 # INET_E_INVALID_CERTIFICATE
sCode = "The SSL certificate is invalid."
Else
sCode = "No error code description"
EndSwitch
Return sCode
EndFunc
Func WinInetDownloadFile(URL, FileName, Silent = 0, Style = 0)
Static GENERIC_WRITE = 0x40000000, _
CREATE_ALWAYS = 2, FILE_ATTRIBUTE_NORMAL = 128
Static INTERNET_OPEN_TYPE_PRECONFIG = 0, _
INTERNET_FLAG_RELOAD = 0x80000000, _
INTERNET_FLAG_NO_CACHE_WRITE = 0x04000000
# Static INVALID_HANDLE_VALUE = auX64 ? 0xFFFFFFFFFFFFFFFF : 0xFFFFFFFF
Static INVALID_HANDLE_VALUE = auX64 ? 18446744073709551615 : 4294967295
Local hInt, hUrl, nSysErr, sAgent = "Autorun Downloader"
If Not Silent Then
tip("Internet connection.", 1, "Download", Style)
Sleep(200)
EndIf
hInt = DllCall("Wininet.dll\InternetOpenW", _
"wstr", sAgent, "dword", INTERNET_OPEN_TYPE_PRECONFIG, _
"ptr", 0, "ptr", 0, "ptr", 0, "handle")
nSysErr = SYSERROR
If Not (hInt > 0) Then
If Not Silent Then
tip("Error: " & nSysErr & auCRLF & _
"Message: " & GetWinInetError(nSysErr) & auCRLF & URL, 3, "Download", Style)
EndIf
Return nSysErr
EndIf
hUrl = DllCall("Wininet.dll\InternetOpenUrlW", _
"handle", hInt, "wstr", URL, "ptr", 0, _
"dword", 0, "dword", INTERNET_FLAG_RELOAD, _
"dword_ptr", 0, "handle")
nSysErr = SYSERROR
If Not (hUrl > 0) Then
DllCall("Wininet.dll\InternetCloseHandle", "handle", hInt)
If Not Silent Then
tip("Error: " & nSysErr & auCRLF & _
"Message: " & GetWinInetError(nSysErr) & auCRLF & URL, 3, "Download", Style)
EndIf
Return nSysErr
EndIf
# HTTP_QUERY_CONTENT_LENGTH | HTTP_QUERY_FLAG_NUMBER
Local flags = BitOR(5, 0x20000000)
Local size, sz = 8
Local buf = Buffer(sz)
buf.Zero()
If DllCall("Wininet.dll\HttpQueryInfoW", _
"handle", hUrl, "dword", flags, "ptr", buf.ptr, "dword*", @sz, "ptr", 0) Then
size = buf.GetNum(0, "int64")
EndIf
Free(buf)
hFile = DllCall("CreateFileW", _
"wstr", FileName, "dword", GENERIC_WRITE, _
"dword", 0, "ptr", 0, "dword", CREATE_ALWAYS, _
"dword", FILE_ATTRIBUTE_NORMAL, "ptr", 0, "handle")
nSysErr = SYSERROR
If hFile <= 0 Or hFile = INVALID_HANDLE_VALUE Then
DllCall("Wininet.dll\InternetCloseHandle", "handle", hUrl)
DllCall("Wininet.dll\InternetCloseHandle", "handle", hInt)
If Not Silent Then
tip("File can't be created. Error: " & nSysErr & auCRLF & _
GetWinInetError(nSysErr) & auCRLF & FileName, 3, "Download", Style)
EndIf
Return nSysErr
EndIf
Local buf = Buffer(1024*2), bytes, written, total, prc
buf.Zero()
Local T1 = GetUptime(), T2 = T1, T3, nStyle = BitOR(Style, 1)
Do
bRes = DllCall("Wininet.dll\InternetReadFile", _
"handle", hUrl, "ptr", buf.ptr, "dword", buf.size, "dword*", @bytes)
If bRes And bytes > 0 Then
DllCall("WriteFile", "handle", hFile, _
"ptr", buf.ptr, "dword", bytes, "dword*", @written, "ptr", 0)
total += bytes
If Not Silent And size > buf.size Then
T3 = GetUptime()
If Round(T3 - T2, 0) > 500 Then
prc = "Download " & Round(total/size*100,0) & '%'
tip('Загружено: ' & SizeFormat(total, 1, 'M', 2) & ' ' & _
'из ' & SizeFormat(size, 1, 'M', 2), 1, prc, nStyle)
Sleep(10)
T2 = T3
EndIf
EndIf
EndIf
If IsPressed(0x1B) Then bRes = false
Until Not (bRes And bytes > 0)
DllCall("CloseHandle", "handle", hFile)
DllCall("Wininet.dll\InternetCloseHandle", "handle", hUrl)
DllCall("Wininet.dll\InternetCloseHandle", "handle", hInt)
T3 = Round(GetUptime() - T1, 0) / 1000
T3 = "Время операции: " & StrFormat("%.3f", T3) & " sec"
If Not Silent Then
If bRes Then
txt = "Download successful." & auCRLF & FileName & auCRLF & T3
tip(txt, 1, "Download", nStyle)
Else
txt = "Download failed or ended with an error." & auCRLF & T3
tip(txt, 3, "Download", nStyle)
EndIf
EndIf
Return (bRes ? 0 : -1)
EndFunc
Func GetWinInetError(nCode)
Local sMsg
Local hModule = DllCall("GetModuleHandleW", "Wstr", "wininet.dll", "handle")
If Not (hModule > 0) Then
Return "GetModuleHandle failed for wininet.dll. Error: " & SYSERROR
EndIf
Local FORMAT_MESSAGE_FROM_HMODULE = 0x00000800
Local FORMAT_MESSAGE_ALLOCATE_BUFFER = 0x00000100
Local FORMAT_MESSAGE_IGNORE_INSERTS = 0x00000200
Local FORMAT_MESSAGE_FROM_SYSTEM = 0x00001000
Local flags = BitOR(FORMAT_MESSAGE_FROM_HMODULE, _
FORMAT_MESSAGE_IGNORE_INSERTS, _
FORMAT_MESSAGE_FROM_SYSTEM)
Local buf = Buffer(1024)
buf.Zero()
If DllCall("FormatMessageW", "dword", flags, "ptr", hModule, _
"dword", nCode, "dword", 0, "ptr", buf.ptr, "dword", buf.size, "ptr", 0) Then
sMsg = StrTrim(buf.GetStr())
Else
sMsg = "Failed to find error description"
EndIf
Free(buf)
Return sMsg
EndFunc
Global gTipText, gTipX, gTipY,
Global gTipWndProc, gTipWP = Callback("tipwp", "hwnd;uint;wparam;lparam")
#{
nFlags:
1 - Previous window position
2 - Square tooltip window
4 - Inactive tooltip window
0 - Default
#}
Func tip(sText, nIcon = 0, sTitle = "Tip", nFlags = 0)
Static TTM_TRACKACTIVATE = 1041, _
TTM_TRACKPOSITION = 1042, _
TTM_SETMAXTIPWIDTH = 1048, _
TTM_SETTITLE = 1057, _
TTM_ADDTOOL = 1074, _
TTM_UPDATETIPTEXT = 1081
Static txt = Buffer(1026)
Static hTip = 0, buf = Buffer(auX64 ? 56 : 40)
Local nMaxWidth = 200
If hTip = 0 Then
# TTS_BALLOON | TTS_CLOSE | TTS_NOPREFIX
hTip = DllCall("CreateWindowExW", _
"dword", 8, _
"wstr", "tooltips_class32", _
"wstr", "", "dword", 0x00000c2, _
"int", 0, "int", 0, "int", 0, "int", 0, _
"handle", 0, _
"handle", 0, "handle", 0, "ptr", 0, "handle")
If hTip = 0 Then
MsgBox("Не удалось создать окно подсказки")
Return 0
EndIf
gTipWndProc = DllCall("SetWindowLong" & (auX64 ? "PtrW" : "W"), _
"hwnd", hTip, "int", -4, "long_ptr", gTipWP.Ptr, "ptr")
txt.Zero()
txt.SetStr(sTitle & Chr(0))
SendMessage(hTip, TTM_SETTITLE, nIcon, txt.ptr)
buf.Zero()
# TTF_TRACK | TTF_ABSOLUTE
buf.SetNum(0, "uint", buf.size, "uint", 0x00a0)
buf.SetNum(auX64 ? 48 : 36, "ptr", txt.ptr)
SendMessage(hTip, TTM_ADDTOOL, 0, buf.ptr)
SendMessage(hTip, TTM_SETMAXTIPWIDTH, 0, nMaxWidth)
EndIf
If sText = "" Then
SendMessage(hTip, TTM_TRACKACTIVATE, 0, buf.ptr)
Return hTip
EndIf
# cartoon or square
Local op = (BitAND(nFlags, 2) ? 4 : 2)
WinSetStyle(0x0000040, op, hTip)
txt.Zero()
txt.SetStr(sTitle & Chr(0))
SendMessage(hTip, TTM_SETTITLE, nIcon, txt.ptr)
txt.Zero()
txt.SetStr(sText & Chr(0))
# the next call won't fail if the tip is not visible
If WinGetState(2, hTip) = 0 Then
SendMessage(hTip, TTM_TRACKACTIVATE, 0, buf.ptr)
EndIf
SendMessage(hTip, TTM_UPDATETIPTEXT, 0, buf.ptr)
SendMessage(hTip, TTM_TRACKACTIVATE, 1, buf.ptr)
WinGetPos("x", "y", "w", "h", hTip)
# the tip will appear at the mouse pointer by default
If Not BitAND(nFlags, 1) Then MouseGetPos("x","y")
# preventing the tip from going off screen
If x + w > SYSINFO_DESKTOPWIDTH Then x = SYSINFO_DESKTOPWIDTH - w
If y + h > SYSINFO_DESKTOPHEIGHT Then y = SYSINFO_DESKTOPHEIGHT - h
SendMessage(hTip, TTM_TRACKPOSITION, 0, MakeInt(x, y, 0))
gTipX = x
gTipY = y
If Not BitAND(nFlags, 4) Then WinSetState(23, hTip)
Return hTip
EndFunc
Func tipwp(hWnd, uMsg, wParam, lParam)
Static MK_LBUTTON = 0x0001, TTM_TRACKPOSITION = 1042
Static DragWidth = GetSystemMetrics(68) #SM_CXDRAG
Static DragHeight = GetSystemMetrics(69) #SM_CYDRAG
Static IsDrag = 0, StartX = 0, StartY = 0
Local x, y
Static tx, ty, buf = Buffer(8)
Switch uMsg
Case 0x0018 # WM_SHOWWINDOW
Case 0x0201 # WM_LBUTTONDOWN
If IsDrag = 0 Then
buf.Zero()
x = BitAND(lParam, 0xFFFF)
y = BitAND(BitShift(lParam,16), 0xFFFF)
StartX = x
StartY = y
buf.SetNum(0, "int", x, "int", y)
DllCall("ClientToScreen", "hwnd", hWnd, "ptr", buf.ptr)
tx = buf.GetNum(0)
ty = buf.GetNum(4)
IsDrag = 1
DllCall("SetCapture", "hwnd", hWnd, "hwnd")
EndIf
Case 0x0202 # WM_LBUTTONUP
If IsDrag = 1 Then
WinGetPos("gTipX", "gTipY", "", "", hWnd)
IsDrag = 0
DllCall("ReleaseCapture")
EndIf
Case 0x0200 # WM_MOUSEMOVE
If IsDrag = 1 And BitAND(wParam, MK_LBUTTON) Then
x = BitAND(lParam, 0xFFFF)
y = BitAND(BitShift(lParam,16), 0xFFFF)
If Abs(x - startX) > DragWidth Or Abs(y - startY) > DragHeight Then
buf.Zero()
buf.SetNum(0, "int", x, "int", y)
DllCall("ClientToScreen", "hwnd", hWnd, "ptr", buf.ptr)
x = buf.GetNum(0)
y = buf.GetNum(4)
SendMessage(hWnd, TTM_TRACKPOSITION, 0, MakeInt(gTipX+(x-tx), gTipY+(y-ty), 0))
EndIf
EndIf
Case 0x0205 # WM_RBUTTONUP
gTipText = WinGetText(hWnd)
ShowPopupMenu /D /F /I:0 "tipmnu"
Case 0x0100 # WM_KEYDOWN
If wParam = 0x1B Then WinSetState(0, hWnd)
EndSwitch
Return DllCall("CallWindowProcW", _
"ptr", gTipWndProc, "hwnd", hWnd, "uint", uMsg, "wparam", wParam, "lparam", lParam)
EndFunc
Func tipmnu()
Local txt
txt &= 'MENUITEM "Copy text", em_aucmd ' & (gTipText <> "" ? "" : "/D") & ' -1 tipcopy' & auCRLF
Return txt
EndFunc
Func tipcopy()
#ClipPut %"gTipText"
ClipPut(gTipText)
EndFunc |
Первая функция URLDownloadToFile, о ней было выше. Вместо этой функции можно делать прямой DLL-вызов, как было примере.
Вторая функция WinInetDownloadFile - более продвинутый вариант. Есть "тихий" режим и возможность передавать флаги для стиля подсказки.
Третья функция tip(). Универсальное окно подсказки типа "балун", которое можно использовать в других целях. При первом вызове tip() создается окно и дескриптор сохраняется до конца сессии. Последующие вызовы tip() скрывают и показывают это окно с обновленным текстом. Чем-то это похоже на функцию ShowHint в Autorun.
По умолчанию подсказка показывается у мыши. Возможность задавать координаты отсутствует, но есть флаг "1", который отображает подсказку на позиции предыдущего вызова, а позицию первого вызова можно задать через MouseSetPos, если это нужно.
Всего действуют три флага, их можно суммировать. Флаг "2" делает окно подсказки квадратным, а флаг "4" не делает окно активным после вызова. Но в последнем случае подсказка не будет закрываться по ESC. Когда окно подсказки активно, ESC ее закрывает.
Также ESC прерывает операцию загрузки у функции WinInetDownloadFile, т.е. операцию загрузки можно в любой момент отменить.
После вызова подсказки скрипт движется дальше. Если необходимо дождаться закрытия окна подсказки и затем продолжить выполнение, можно организовать цикл с проверкой состояния через дескриптор. В примере это есть. Текст подсказки можно скопировать в буфер.
Самый простой пример загрузки нескольких файлов:
 Hidden text | Code: | RegisterCommand 60036 "DownloadTest"
Func DownloadTest()
Local URL1 = "https://www.autohotkey.com/download/2.0/version.txt"
Local URL2 = "https://www.mp3tag.de/en/download.html"
Local URL3 = "https://totalcommander.ch/1156/newcert/tcmd1156x64.exe"
Local URL4 = "https://totalcommander.ch/1156/newcert/tcmd1156x32_64.exe"
WinInetDownloadFile(URL1, TEMP & "\ahk2.ver")
Sleep(2000)
WinInetDownloadFile(URL2, TEMP & "\mp3tag.html")
Sleep(2000)
WinInetDownloadFile(URL3, TEMP & "\tcmd1156x64.exe")
Sleep(2000)
WinInetDownloadFile(URL4, TEMP & "\tcmd1156x32_64.exe")
EndFunc |
Более сложный пример с флагами и циклом ожидания:
 Hidden text | Code: | RegisterCommand 60037 "DownloadParamTest"
Func DownloadParamTest()
Local Res, Num = 0
Local URL1 = "https://www.autohotkey.com/download/2.0/version.txt"
Local URL2 = "https://www.mp3tag.de/en/download.html"
Local URL3 = "https://totalcommander.ch/1156/newcert/tcmd1156x64.exe"
Local URL4 = "https://totalcommander.ch/1156/newcert/tcmd1156x32_64.exe"
# getting tooltip window handle
Local hTip = tip("")
# default download window:
# cartoon-like, not silent, mouse position
Res = WinInetDownloadFile(URL1, TEMP & "\ahk2.ver")
If Res = 0 Then Num += 1
Sleep(2000)
# keep previous position, param 1
Res = WinInetDownloadFile(URL2, TEMP & "\mp3tag.html", 0, 1)
If Res = 0 Then Num += 1
Sleep(2000)
# square tooltip window, param 2
Res = WinInetDownloadFile(URL3, TEMP & "\tcmd1156x64.exe", 0, 2)
If Res = 0 Then Num += 1
Sleep(2000)
# tooltip window is not active, param 4
Res = WinInetDownloadFile(URL4, TEMP & "\tcmd1156x32_64.exe", 0, 4)
If Res = 0 Then Num += 1
# optional waiting for the tooltip window to close
Local bWait = true
If bWait And hTip > 0 Then
Do
Sleep(50)
Until Not WinGetState(2, hTip)
MsgBox("Operation complete." & auCRLF & auCRLF & _
"Successfully downloaded " & num & " of 4 files.", "Autorun", 64)
EndIf
EndFunc |
Результат
Закачка открывает большие возможности, примеров применения может быть масса. Главное, что теперь не нужно прибегать к сторонним скриптам и утилитам, а делать это сразу из ТС.
Пример проверки страницы плагинов:
 Hidden text | Code: | RegisterCommand 60034 "PluginsCheck"
Func PluginsCheck()
Local hr, url, file, txt, items = 20
url = "https://wincmd.ru/directory/" & items & "new.html"
file = TEMP & "\" & items & "plugin.news"
If IsPressed(0x11) Then
tip("Internet connection.", 1, "Urlmon.dll")
Sleep(700)
hr = DllCall("Urlmon.dll\URLDownloadToFileW", _
"ptr", 0, "wstr", url, "wstr", file, "dword", 0, "ptr", 0, "hresult")
If hr <> 0 Then
txt = "An error occured." & auCRLF & url & auCRLF & _
"Error code: " & hr & auCRLF & GetINetECode(hr)
Return tip(txt, 3, "Urlmon.dll")
EndIf
tip("Successful download.", 1, "Urlmon.dll")
PluginsParse(file, 1)
Return
EndIf
hr = WinInetDownloadFile(url, file)
Local updated = (hr = 0 ? 1 : 0)
If FileExist(file) Then PluginsParse(file, updated)
EndFunc
Func PluginsParse(Filename, Updated)
Local rex, out, small, i = 0
Local txt = FileRead(Filename)
rex = RegExp('<h3 class="name"><a href="(.*?)">(.*?)</a></h3>(?:.*?)<small>(.*?)</small></p>', txt)
If rex.Exec() Then
Do
i += 1
out &= StrReplace(rex.Match[2], " ", " ") & auCRLF
out &= rex.Match[1] & auCRLF
small = StrReplace(rex.Match[3], " ", " ")
small = StrReplace(small, "<b>", "")
small = StrReplace(small, "</b>", "")
out &= small & auCRLF & auCRLF
Until not rex.ExecNext()
out = (Updated ? "Обновлено" : "Не обновлено") & auCRLF & auCRLF & out
EndIf
Free(rex)
MsgBox(out, "Plugins " & i, Updated ? 64 : 48)
EndFunc |
То же самое, что и парсинг rss-ленты, но загрузка html имеет свои плюсы.
Пример запроса к API метео-сайта и получение csv-файла:
 Hidden text | Code: | RegisterCommand 60035 "MeteoSwissReport"
Func MeteoSwissReport()
Local hr, url, file, txt, code, msg
url = "https://api.open-meteo.com/v1/forecast?latitude=47.37&longitude=8.55&" & _
"daily=temperature_2m_max,temperature_2m_min&models=meteoswiss_icon_ch1&" & _
"current=temperature_2m,relative_humidity_2m,cloud_cover&timezone=auto&forecast_days=1&format=csv"
file = TEMP & "\meteo.csv"
If IsPressed(0x11) Then
hr = DllCall("Urlmon.dll\URLDownloadToFileW", _
"ptr", 0, "wstr", url, "wstr", file, "dword", 0, "ptr", 0, "hresult")
If hr <> 0 Then
txt = "An error occured." & auCRLF & url & auCRLF & _
"Error code: " & hr & auCRLF & GetINetECode(hr)
Return tip(txt, 3)
EndIf
EndIf
# silent mode, param 1
code = WinInetDownloadFile(url, file, 1)
If code = -1 Then
msg = "Updating from the Internet was interrupted or failed"
tip(msg, 3)
Return
ElseIf code > 0 Then
msg = "Updating from the Internet failed. Error: " & code & auCRLF
msg &= GetWinInetError(code)
tip(msg, 3)
Return
EndIf
If Not FileExist(file) Then Return MsgBox("File missing " & file)
# local file processing
Local lst = List()
lst.LoadFromFile(file)
If lst.count < 7 Then Return MsgBox("File corrupted " & file)
Local gps = Round(StrPart(lst[1], ",", 1), 2) & ", " & Round(StrPart(lst[1], ",", 2), 2)
Local elv = StrPart(lst[1], ",", 3) & " meters"
Local tmz = StrPart(lst[1], ",", 5) & ", " & StrPart(lst[1], ",", 6)
Local ltm = StrPart(lst[4], ",", 1)
Local tmp = StrPart(lst[4], ",", 2) & "°C"
Local ext = StrPart(lst[4], ",", 3) & "%, Clouds: " & StrPart(lst[4], ",", 4) & "%"
Local max = StrPart(lst[7], ",", 2) & "°C"
Local min = StrTrim(StrPart(lst[7], ",", 3)) & "°C"
Local ltm = StrReplace(ltm, "T", " ")
txt = "GPS: " & gps & auCRLF
txt &= "Elevation: " & elv & auCRLF
txt &= "Timezone: " & tmz & auCRLF
txt &= "Local time: " & ltm & auCRLF
txt &= "Temperature: " & tmp & auCRLF
txt &= "Humidity: " & ext & auCRLF
txt &= "Max for the day: " & max & " Min: " & min
Free(lst)
ShowHint(txt)
ClipPut(txt)
EndFunc |
Ну, и на десерт - загрузка рандомных цитат из разных источников:
 Hidden text | Code: | RegisterCommand 71110 "OneQuote"
Func OneQuote()
Local hr, url, file, txt
Local u1 = "https://api.forismatic.com/api/1.0/?method=getQuote&format=text"
Local u2 = "https://www.quoterism.com/api/quotes/random"
Local u3 = "https://zenquotes.io/api/random"
Local u4 = "https://stoic.tekloon.net/stoic-quote"
# https://favqs.com/api/qotd
Static c = 0
c += 1
If c > 4 Then c = 1
url = Eval("u" & c)
file = TEMP & "\quote.one"
hr = DllCall("Urlmon.dll\URLDownloadToFileW", _
"ptr", 0, "wstr", url, "wstr", file, "dword", 0, "ptr", 0, "hresult")
If hr = 0 Then
txt = FileRead(file, 1024)
If ERROR = 1 Then Return MsgBox("Ошибка чтения " & file, "Quote", 16)
Local q, a
If c = 2 Then
q = RegExpGet(txt, '"text":"(.*?)"', "$1")
a = RegExpGet(txt, '"name":"(.*?)"', "$1")
ElseIf c = 3 Then
q = RegExpGet(txt, '"q":"(.*?)"', "$1")
a = RegExpGet(txt, '"a":"(.*?)"', "$1")
ElseIf c = 4 Then
q = RegExpGet(txt, '"quote":"(.*?)"', "$1")
a = RegExpGet(txt, '"author":"(.*?)"', "$1")
EndIf
If a <> "" Then a = " (" & a & ")"
If c > 1 Then txt = q & a
If txt = '' Then Return MsgBox("Файл поврежден " & file, "Quote", 16)
tip(txt, 1, "Quote " & c)
Else
txt = "An error occured." & auCRLF & url & auCRLF & _
"Error code: " & hr & auCRLF & GetINetECode(hr)
tip(txt, 3, "Quote")
EndIf
EndFunc |
 Hidden text
 Hidden text Задержка на видео связана с тем, что я действительно пытался читать  Правильно. Глядишь может и поумнею. Там ведь цитаты великих людей попадаются - Мэрлин Монро и Коко Шанель, а то я всё Сара Коннор да Сара Коннор.
Какую функцию лучше использовать, наверное WinInetDownloadFile, она более продвинутая. Но и на URLDownloadToFile многое может работать.
Кнопки:
 Hidden text TOTALCMD#BAR#DATA
60033
Shell32.dll,13
RSS Check
-1
 Hidden text TOTALCMD#BAR#DATA
60034
Shell32.dll,13
Wincmd.ru Plugins|CTRL - Use Urlmon.dll
-1
 Hidden text TOTALCMD#BAR#DATA
60035
Shell32.dll,13
Meteo Swiss Test|CTRL - Use Urlmon.dll
-1
 Hidden text TOTALCMD#BAR#DATA
60036
Shell32.dll,135
Download Test
-1
 Hidden text TOTALCMD#BAR#DATA
60037
Shell32.dll,135
Download Test
-1
 Hidden text TOTALCMD#BAR#DATA
71110
Shell32.dll,13
One quote
-1 |
|