Reputation: 849
I want to change the INSTALLDIR value for my Installer during Installation using Installscript. How should I do it? I have already tried the following: Created a custom action as:
function InitializeValues(hMSI)
STRING svProductName;
STRING svInstallDir;
NUMBER nvSize;
begin
nvSize=255;
MsiGetProperty (hMSI, "ProductName", svProductName, nvSize);
if(svProductName = "Notepad Pro") then
svInstallDir = PROGRAMFILES ^ svProductName;
// MsiSetTargetPath(hMSI,INSTALLDIR,svInstallDir);
MsiSetProperty(hMSI,INSTALLDIR,svInstallDir);
MessageBox(INSTALLDIR,INFORMATION);
endif;
end;
My custom action gets executed but the value of INSTALLDIR does not changes. I have scheduled my custom action in UI Sequence before Cost Finalize and in Execute Sequence After Cost Finalize.
Please help.
Upvotes: 2
Views: 4617
Reputation: 21426
In both InstallUISequence and InstallExecuteSequence the custom action should run before CostFinalize. Also, MsiSetProperty is not used that way and I don't think it will work in InstallScript.
You can try using:
INSTALLDIR = svInstallDir
or
MsiSetProperty(hMSI, "INSTALLDIR", svInstallDir);
Upvotes: 6