title: How can I use innosetup to automatically download files from Microsoft
body: <p>I am using InnoSetup Tools Downloader plugin <a href="https://github.com/wilbit/itdownload" rel="nofollow noreferrer">from here</a>.
  It enables downloading external internet files during installation.
  While it can work in many cases, but in some case like this: </p>
  
  <pre><code>itd_addfile('http://download.microsoft.com/download/1/d/b/1dbee406-9b5f-48c5-b901-dd1a3f3c4669/Merlin.exe',expandconstant('{tmp}\Merlin.exe'));
  </code></pre>
  
  <p>It complains with the following:</p>
  
  <blockquote>
    <p>Sorry, the files could not be downloaded. Check your connection and
    click ''Retry'' to try downloading the files again, or click
    ''Cancel'' to terminate setup.</p>
  </blockquote>
  
  <p>WE can use webbrowser to open and download:</p>
  
  <pre><code>http://download.microsoft.com/download/1/d/b/1dbee406-9b5f-48c5-b901-dd1a3f3c4669/Merlin.exe
  </code></pre>
  
  <p>Why it cannot be automatically downloaded by itdownload?<br>
  How to fix it? </p>
  
  <p>Below is the modified example1 which caused the problem.</p>
  
  <pre><code>#define MyAppName "My Program"
  #define MyAppVerName "My Program 1.5"
  #define MyAppPublisher "My Company, Inc."
  #define MyAppURL "http://www.mycompany.com"
  
  [Setup]
  AppName={#MyAppName}
  AppVerName={#MyAppVerName}
  AppPublisher={#MyAppPublisher}
  AppPublisherURL={#MyAppURL}
  AppSupportURL={#MyAppURL}
  AppUpdatesURL={#MyAppURL}
  DefaultDirName={pf}\{#MyAppName}
  DefaultGroupName={#MyAppName}
  OutputBaseFilename=example1
  Compression=lzma
  SolidCompression=true
  CreateAppDir=true
  ShowLanguageDialog=yes
  
  [Languages]
  Name: english; MessagesFile: compiler:Default.isl
  
  #include ReadReg(HKEY_LOCAL_MACHINE,'Software\Sherlock Software\InnoTools\Downloader','ScriptPath','');
  
  [Code]
  procedure InitializeWizard();
  begin
   itd_init;
  
   //Let's download two zipfiles from MS Agent  website..
   itd_addfile('http://download.microsoft.com/download/1/d/b/1dbee406-9b5f-48c5-b901-dd1a3f3c4669/Merlin.exe',expandconstant('{tmp}\Merlin.exe'));
  
   //Start the download after the "Ready to install" screen is shown
   itd_downloadafter(wpReady);
  end;
  
  procedure CurStepChanged(CurStep: TSetupStep);
  begin
   if CurStep=ssInstall then begin //Lets install those files that were downloaded for us
    filecopy(expandconstant('{tmp}\Merlin.exe'),expandconstant('{app}\Merlin.exe'),false);
   end;
  end;
  </code></pre>