<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: Не скачивает файл Беру url (файла) из файла txt на сервере]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=17073&amp;type=atom" />
	<updated>2022-04-25T12:26:06Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=17073</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Не скачивает файл Беру url (файла) из файла txt на сервере]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=152840#p152840" />
			<content type="html"><![CDATA[<p><strong>teadrinker</strong><br />Должно брать ссылку из файла https://raw.githubusercontent.com/Agressorx1/efttorg/main/file.txt<br />и потом из той ссылки из файла происходит скачивание.</p>]]></content>
			<author>
				<name><![CDATA[Shamankingx]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=42481</uri>
			</author>
			<updated>2022-04-25T12:26:06Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=152840#p152840</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Не скачивает файл Беру url (файла) из файла txt на сервере]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=152839#p152839" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Shamankingx пишет:</cite><blockquote><div class="codebox"><pre><code>url = https://cdn.filesend.jp%Variable%
msgbox, % url -----------Вывод ссылки на файл и она правильная</code></pre></div></blockquote></div><p>Нет, не правильная, смотрите внимательно.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2022-04-25T11:31:12Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=152839#p152839</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Не скачивает файл Беру url (файла) из файла txt на сервере]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=152838#p152838" />
			<content type="html"><![CDATA[<p><strong>teadrinker</strong><br />вот реальная ссылка https://raw.githubusercontent.com/Agressorx1/efttorg/main/file.txt</p>]]></content>
			<author>
				<name><![CDATA[Shamankingx]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=42481</uri>
			</author>
			<updated>2022-04-25T10:53:34Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=152838#p152838</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Не скачивает файл Беру url (файла) из файла txt на сервере]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=152833#p152833" />
			<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>2022-04-25T10:25:11Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=152833#p152833</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: Не скачивает файл Беру url (файла) из файла txt на сервере]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=152831#p152831" />
			<content type="html"><![CDATA[<p>Я беру ссылку из файла на сервере .<br />В переменной&nbsp; Variable в msgbox появляется нужна и правильная ссылка ,но появляется process bar скачивая и сразу закрывается скачивание не начинается.<br /></p><div class="codebox"><pre><code>
#SingleInstance,Force
url=https://raw.githubusercontent.com/Agressorx1/efttorg/main/file.txt----------Пример ссылки
Gui,Add,Edit,w800 h500 -Wrap,% URLDownloadToVar(url)
URLDownloadToVar(url){
	hObject:=ComObjCreate(&quot;WinHttp.WinHttpRequest.5.1&quot;)
	hObject.Open(&quot;GET&quot;,url)
	hObject.Send()
	return hObject.ResponseText
}
variable:=% URLDownloadToVar(url) 
url = % variable
msgbox, % url -----------Вывод ссылки на файл и она правильная ,но скачивание нету
SplitPath,url,name, dir, ext, name_no_ext, drive
DownloadAs := &quot;C:\Windows\SysWOW64\downlevel\lodsh\edit\&quot; . name
	Overwrite      := True
	UseProgressBar := True
	DownloadFile(Url, DownloadAs, Overwrite, UseProgressBar)
return
;=================== Start Functions =====================================================================

DownloadFile(UrlToFile, SaveFileAs, Overwrite := True, UseProgressBar := True) {
    ;Check if the file already exists and if we must not overwrite it
      If (!Overwrite &amp;&amp; FileExist(SaveFileAs))
          Return
    ;Check if the user wants a progressbar
      If (UseProgressBar) {
          ;Initialize the WinHttpRequest Object
            WebRequest := ComObjCreate(&quot;WinHttp.WinHttpRequest.5.1&quot;)
          ;Download the headers
            WebRequest.Open(&quot;HEAD&quot;, UrlToFile)
            WebRequest.Send()
          ;Store the header which holds the file size in a variable:
            FinalSize := WebRequest.GetResponseHeader(&quot;Content-Length&quot;)
          ;Create the progressbar and the timer
		 Progress, H80 Cb018AF3, , Downloading..., %UrlToFile%
            SetTimer, __UpdateProgressBar, 100
      }
    ;Download the file
      UrlDownloadToFile, %UrlToFile%, %SaveFileAs%
    ;Remove the timer and the progressbar because the download has finished
      If (UseProgressBar) {
          Progress, Off
          SetTimer, __UpdateProgressBar, Off
      }
    Return

    ;The label that updates the progressbar
      __UpdateProgressBar:
          ;Get the current filesize and tick
            CurrentSize := FileOpen(SaveFileAs, &quot;r&quot;).Length ;FileGetSize wouldn&#039;t return reliable results
            CurrentSizeTick := A_TickCount
          ;Calculate the downloadspeed
            Speed := Round((CurrentSize/1024-LastSize/1024)/((CurrentSizeTick-LastSizeTick)/1000)) . &quot; Kb/s&quot;
          ;Save the current filesize and tick for the next time
            LastSizeTick := CurrentSizeTick
            LastSize := FileOpen(SaveFileAs, &quot;r&quot;).Length
          ;Calculate percent done
            PercentDone := Round(CurrentSize/FinalSize*100)
          ;Update the ProgressBar
            Progress, %PercentDone%, %PercentDone%`% Готовность, Подготовка к запуску, Подготовка к запуску (%PercentDone%`%)
      Return
}
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Shamankingx]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=42481</uri>
			</author>
			<updated>2022-04-25T06:11:43Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=152831#p152831</id>
		</entry>
</feed>
