2016-11-18 8 views
1

インターネット経由でダウンロードしたアプリケーションをコードセクションで実行し、そのアプリケーションの実行が完了するまで待つ方法私は、InnoToolsダウンローダを使用して、これらの2つのファイルをダウンロードした後、2番目のダウンロードがダウンロードを実行した後、またはjdk-8u111-windows-x64.exeを実行した後、インストールを続行します。Inno Setupのコードセクションにダウンロードしてプログラムを実行した後

[Code]  

procedure InitializeWizard();  
begin  
     ITD_Init; 

     ITD_AddFile('http://www-us.apache.org/dist/tomcat/tomcat-9/v9.0.0.M13/bin/apache-tomcat-9.0.0.M13-windows-x64.zip', expandconstant('{tmp}\apache-tomcat-9.0.0.M13-windows-x64.zip')); 

     ITD_DownloadAfter(1);  

     ITD_AddFile('http://files.downloadnow-1.com/s/software/15/62/36/39/jdk-8u111-windows-x64.exe?token=1479511171_b51e94edd4e002c94fd60a570a7dd270&fileName=jdk-8u111-windows-x64.exe',expandconstant('{tmp}\jdk-8u111-windows-x64.exe')); 

     ITD_DownloadAfter(2);        
end; 
+0

'wpXXX'定数ではなく、マジックナンバーを使用してください。 –

+0

ITD_DownloadAfterを複数回呼び出すのは間違いです。 –

+0

とにかくITDを使用しないでください。それは時代遅れです。 AnsiバージョンのInno Setupのみをサポートしています。そして、スケールしない。 125%ズームで見た目が醜いのを見てください。(網膜ディスプレイの高倍率でのみ)https://i.stack.imgur.com/QfA4k.png –

答えて

1

ITDではなく他のダウンロードプラグインを使用します(理由は下記を参照)。

たとえば、Inno Download Plugin

idp.issを含めると、グローバルIDPForm構造が定義されます。そのPageフィールドは、ダウンロードページを表すTWizardPageです。 (自動的に「押し」されたダウンロードページで「次へ」ボタン)ダウンロードが完了後、ダウンロードしたファイルを実行するためにNextButtonClickにそのIDを使用します。

#include <idp.iss> 

[Code] 

procedure InitializeWizard; 
begin 
    idpAddFile(
    'https://www-us.apache.org/dist/tomcat/tomcat-9/v9.0.0.M13/bin/' + 
     'apache-tomcat-9.0.0.M13-windows-x64.zip', 
    ExpandConstant('{tmp}\apache-tomcat-9.0.0.M13-windows-x64.zip')); 
    idpAddFile(
    'https://www.example.com/jdk-8u111-windows-x64.exe', 
    ExpandConstant('{tmp}\jdk-8u111-windows-x64.exe')); 
    idpDownloadAfter(wpSelectDir); 
end; 

function NextButtonClick(CurPageID: Integer): Boolean; 
var 
    ResultCode: Integer; 
    FileName: string; 
begin 
    if CurPageID = IDPForm.Page.ID then 
    begin 
    FileName := ExpandConstant('{tmp}\jdk-8u111-windows-x64.exe'); 
    Result := Exec(FileName, '', '', SW_SHOW, ewWaitUntilTerminated, ResultCode); 

    if not Result then 
    begin 
     MsgBox('Cannot execute sub-installer', mbError, MB_OK); 
    end 
     else 
    begin 
     Result := (ResultCode = 0); 
     if not Result then 
     begin 
     MsgBox('Sub-installer failed', mbError, MB_OK); 
     end 
    end; 
    end 
    else 
    begin 
    Result := True; 
    end; 
end; 

あなたが使用して同じことを実現することができますがInnoTools Downloader、それを避ける必要があります:

  • これは時代遅れであり、もはや維持されません。
  • Unicode Innoセットアップはサポートされていません(新しいプロジェクトにはAnsi Innoセットアップを使用しないでください)。
  • ダウンロードサポートHTTPS;
  • ダウンロードページdoes not scale on high DPI

とにかく、ITD_DownloadAfterは、ダウンロードページを表すTWizardPageを返します。 (ダウンロードページの「次へ」ボタンが自動的に「押し」された)、ダウンロードが完了すると、ダウンロードしたファイルを実行するためにNextButtonClickにそのIDを使用します。

var 
    DownloadPage: TWizardPage; 

procedure InitializeWizard(); 
begin 
    ITD_Init; 
    ITD_AddFile(
    'http://www.example.com/jdk-8u111-windows-x64.exe', 
    ExpandConstant('{tmp}\jdk-8u111-windows-x64.exe')); 
    DownloadPage := ITD_DownloadAfter(wpSelectDir); 
end; 

function NextButtonClick(CurPageID: Integer): Boolean; 
var 
    ResultCode: Integer; 
begin 
    if CurPageID = DownloadPage.ID then 
    begin 
    Result := 
     Exec(
     ExpandConstant('{tmp}\jdk-8u111-windows-x64.exe'), 
     '', '', SW_SHOW, ewWaitUntilTerminated, ResultCode); 

    if not Result then 
    begin 
     MsgBox('Cannot execute sub-installer', mbError, MB_OK); 
    end 
     else 
    begin 
     Result := (ResultCode = 0); 
     if not Result then 
     begin 
     MsgBox('Sub-installer failed', mbError, MB_OK); 
     end 
    end; 
    end 
    else 
    begin 
    Result := True; 
    end; 
end; 
関連する問題