<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: Скачивание файлов]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=13048&amp;type=atom" />
	<updated>2017-10-03T17:03:13Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=13048</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Скачивание файлов]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=119750#p119750" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>
SetWorkingDir, %A_ScriptDir%
DownloadFile(&quot;https://autohotkey.com/download/ahk-install.exe&quot;, &quot;ahk-install.exe&quot;)
While !FileExist(&quot;ahk-install.exe&quot;)
	Continue
MsgBox, Скачано!
Return

DownloadFile(UrlToFile = &quot;&quot;, SaveFileAs = &quot;&quot;, Overwrite := False, UseProgressBar := True) {
	  If (UrlToFile = &quot;&quot; &amp;&amp; SaveFileAs != &quot;&quot;) {
			If FileExist(SaveFileAs)
				Return &quot;Downloaded&quot;
			Else
				Return &quot;No&quot;
		}
      If (!Overwrite &amp;&amp; FileExist(SaveFileAs))
          Return
      If (UseProgressBar) {
            WebRequest := ComObjCreate(&quot;WinHttp.WinHttpRequest.5.1&quot;)
            WebRequest.Open(&quot;HEAD&quot;, UrlToFile)
            WebRequest.Send()
            FinalSize := WebRequest.GetResponseHeader(&quot;Content-Length&quot;)
            Progress, H80, , Downloading..., %UrlToFile%
            SetTimer, __UpdateProgressBar, 100
      }
      UrlDownloadToFile, %UrlToFile%, %SaveFileAs%
      If (UseProgressBar) {
          Progress, Off
          SetTimer, __UpdateProgressBar, Off
      }
    Return

      __UpdateProgressBar:
            CurrentSize := FileOpen(SaveFileAs, &quot;r&quot;).Length 
            CurrentSizeTick := A_TickCount
            Speed := Round((CurrentSize/1024-LastSize/1024)/((CurrentSizeTick-LastSizeTick)/1000)) . &quot; Kb/s&quot;
            LastSizeTick := CurrentSizeTick
            LastSize := FileOpen(SaveFileAs, &quot;r&quot;).Length
            PercentDone := Round(CurrentSize/FinalSize*100)
            Progress, %PercentDone%, %PercentDone%`% Done, Downloading...  (%Speed%), Downloading %SaveFileAs% (%PercentDone%`%)
      Return
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Странникх]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=30605</uri>
			</author>
			<updated>2017-10-03T17:03:13Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=119750#p119750</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Скачивание файлов]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=119746#p119746" />
			<content type="html"><![CDATA[<p>Сразу после urldownloadtofile просто пишите ваше сообщение. Пока скачивается файл, скрипт замораживается.</p>]]></content>
			<author>
				<name><![CDATA[belyankin12]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=34408</uri>
			</author>
			<updated>2017-10-03T15:48:18Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=119746#p119746</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: Скачивание файлов]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=119735#p119735" />
			<content type="html"><![CDATA[<p>Здравствуйте ребята, прошу Вас в очередной раз мне помочь, я не так давно знаю язык ahk.<br />Помогите пожалуйста сделать загрузку приложений по ссылке. Я знаю что есть команда: &quot;URLDownloadToFile&quot; но я бы хотел узнать, можно ли как то уведомить пользователя о том что загрузка окончена? Если да, то пожалуйста киньте код, буду очень сильно благодарен! Спасибо заранее!</p>]]></content>
			<author>
				<name><![CDATA[andrew.drob71]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=38787</uri>
			</author>
			<updated>2017-10-03T13:48:12Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=119735#p119735</id>
		</entry>
</feed>
