Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

using installscript to change installdir


1 reply to this topic

oferir

oferir
  • Full Members
  • 1 posts

Posted 03 March 2009 - 12:14

Hi,

Im trying to use script to set the installation directory my installation has 2 features, both of them is set to be installed at [INSTALLDIR]

running this script to update the value of the [INSTALLDIR] does not take effect, and the default dir still set.

I haveverified that the registry key is valied and the value is properly exctracted....


Ofer
here is the script:


szKey = "SOFTWARE\\key";
szName = "InstallDir";
nType = REGDB_STRING;
szValue = "test";
nSize = -1;
RegDBSetDefaultRoot (HKEY_LOCAL_MACHINE);
nRetvalue = RegDBGetKeyValueEx(szKey, szName, nType, szValue,nSize);
if (nRetvalue < 0)
then
MessageBox ("failed to get installation dir from registry", SEVERE);
abort;
endif;
setPathresult = MsiSetTargetPath(hMSI,"INSTALLDIR", szValue);

if (setPathresult == ERROR_SUCCESS)
then
MessageBox("ok", SEVERE);
endif;




Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 12 March 2009 - 21:16

QUOTE
setPathresult = MsiSetTargetPath(hMSI,"INSTALLDIR", szValue);
This function is only available in MSI projects. I would expect you get a compile error when using it in a pure InstallScript project.
Instead you can directly set INSTALLDIR:
INSTALLDIR = szValue;