title: Inno Setup, detecting if a parameter file exists?
body: <p>I'm created a setup for a .NET project.  The intention is to automatically build in other MSI's and required packages so that it can scan the system and then automatically install the correct packages as required.</p>
  
  <p>What I have so far:</p>
  
  <pre><code>[Files]
  ; Ensure all the prerequisites are installed
  Source: "C:\3subTimeKeeingApp\3sunptk\prerequisites\mysql-connector-net-6.8.3.msi"; Check: needsMySQLNET; DestDir: "{tmp}"; DestName: "mysqlNET.msi"; Flags: solidbreak
  Source: "C:\3subTimeKeeingApp\3sunptk\prerequisites\mysql-connector-odbc-5.3.2-win32.msi"; Check: needsMySQLODBC; DestDir: "{tmp}"; DestName: "mysqlODBC.msi"; Flags: solidbreak
  Source: "C:\3subTimeKeeingApp\3sunptk\prerequisites\sharepointclientcomponents_x64.msi"; Check: (IsWin64 and needsSharePtClient); DestDir: "{tmp}"; DestName: "sharept.msi"; Flags: solidbreak
  Source: "C:\3subTimeKeeingApp\3sunptk\prerequisites\sharepointclientcomponents_x86.msi"; Check: ((not IsWin64) and needsSharePtClient); DestDir: "{tmp}"; DestName: "sharept.msi"; Flags: solidbreak
  Source: "C:\3subTimeKeeingApp\3sunptk\prerequisites\NDP451-KB2858728-x86-x64-AllOS-ENU.exe"; Check: needsFramework; DestDir: "{tmp}"; DestName: "NDP451.exe"; Flags: ignoreversion
  
  [Run]
  Filename: "msiexec.exe"; Parameters: "/i ""{tmp}\mysqlNET.msi"""; 
  Filename: "msiexec.exe"; Parameters: "/i ""{tmp}\mysqlODBC.msi""";
  Filename: "msiexec.exe"; Parameters: "/i ""{tmp}\sharept.msi"""; 
  Filename: "{tmp}\NDP451.exe"; Parameters: "/q:a /c:""install /l /q"""; WorkingDir: {tmp}; Flags: skipifdoesntexist; StatusMsg: Installing .NET Framework if needed. This may take several minutes.
  
  [Code]
  //--------------------------------------------------------------------------------
  // .NET helpers
  //--------------------------------------------------------------------------------
  function isDotNet451Detected(): Boolean;
  var 
    success: Boolean;
    release: Cardinal;
  begin
    success := RegQueryDWordValue(HKLM, 
                          'SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\', 
                          'Release', 
                          release);
  //For .net versions
  //http://msdn.microsoft.com/en-us/library/hh925568%28v=vs.110%29.aspx#net_b 
    Result := success and (release = 378758);
  end;
  
  function needsFramework(): Boolean;
  begin
    Result := (isDotNet451Detected = False);
  end;
  //--------------------------------------------------------------------------------
  // MySQL .NET connector 6.8.3
  //--------------------------------------------------------------------------------
  function isMySQLNETconnectorInstalled(): Boolean;
  var 
    success: Boolean;
    version: String;
  begin
    success := RegQueryStringValue(HKLM, 
                          'SOFTWARE\Wow6432Node\MySQL AB\MySQL Connector/Net\', 
                          'Version', 
                          version); 
    Result := success and (CompareStr(version, '6.8.3') = 0);
  end;
  
  function needsMySQLNET(): Boolean;
  begin
    Result := (isMySQLNETconnectorInstalled = False);
  end;
  //--------------------------------------------------------------------------------
  // MySQL ODBC Connector 5.3
  //--------------------------------------------------------------------------------
  function isMySQLODBCconnectorInstalled(): Boolean;
  var
    success: Boolean;
    version: String;
  begin
    success := RegQueryStringValue(HKLM, 
                          'SOFTWARE\MySQL AB\MySQL Connector/ODBC 5.3\', 
                          'Version', 
                          version); 
    Result := success and (CompareStr(version, '5.3.2') = 0);
  end;
  
  function needsMySQLODBC(): boolean;
  begin
    Result := (isMySQLODBCconnectorInstalled = False);
  end;
  //--------------------------------------------------------------------------------
  // Sharepoint client components
  //--------------------------------------------------------------------------------
  function isSharepointClientInstalled(): Boolean;
  begin
    Result := RegKeyExists(HKLM, 'SOFTWARE\Microsoft\SharePoint Client Components');
  end;
  
  function needsSharePtClient(): Boolean;
  begin
    Result := (not isSharepointClientInstalled);
  end;
  </code></pre>
  
  <p>The checks in 'Files' section work well, however the 'Run' section tries to install the files which are specified in the 'Parameters' option and these aren't present so I get an error message.</p>
  
  <p>My question is, is there a way to detect if the file specified in 'Parameters' exists before attempting to install?</p>
  
  <p>I've tried BeforeInstall but not sure how to use it as it doesn't seem to accept a return.</p>
  
  <p>Thank you,</p>