0

I need to get a filename of the own installation package within an InstallScript function. How can I do that?

ababo
  • 1,490
  • 1
  • 10
  • 24

2 Answers2

0

I have found a way to get the filename:

function ShowInstallerFilename(hMSI)
    NUMBER maxPath;
    STRING originalDatabase;
begin
    maxPath = MAX_PATH;
    if(MsiGetProperty(hMSI, "OriginalDatabase", originalDatabase, maxPath) == ERROR_SUCCESS) then
        SprintfBox(INFORMATION, "Deferred Execution", "Original database is %s", originalDatabase);
    endif;

    MessageBox("Done", INFORMATION);
end;
ababo
  • 1,490
  • 1
  • 10
  • 24
  • As it turned out this doesn't solve my problem, since I needed the filename rather than "original database" name. – ababo Jun 09 '22 at 10:50
0

SETUPEXEDIR and SETUPEXENAME are MSI properties. You can obtain their values through the MsiGetProperty function. If you are not using an MSI then you can use the PACKAGE_LOCATION system variable, as in

ParsePath(svSetupExeFileName, PACKAGE_LOCATION, FILENAME);
renewinkel
  • 16
  • 1
  • SETUPEXENAME did the job, since I need an installer exe filename, not the "original database" name. Thanks! – ababo Jun 09 '22 at 10:49