cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
kumar_shilp
Level 3

In Install script MSI project not able to fetch InstallDIR or Target Dir

Hi,

I am running below script and not able get INSTALLDIR, TARGETDIR. Only SUPPORTDIR is working fine. Please let me know how to proceed further. Also Provide developer document for Install script MSI Project.

function OnFirstUIAfter()

    STRING szTitle, szMsg1, szMsg2, szOpt1, szOpt2;

    NUMBER bOpt1, bOpt2, nWSetupOptions;

    STRING szWSetupExe,szWSetupDir, szPropertyName, svValue, szInstallDir;

    NUMBER nvBufferSize, nResult;

begin

 

MessageBox("szInstallDir: " + szInstallDir , INFORMATION);          

MessageBox("INSTALLDIR: " + INSTALLDIR , INFORMATION);

MessageBox("TARGETDIR: " + TARGETDIR , INFORMATION);

MessageBox("SUPPORTDIR: " + SUPPORTDIR , INFORMATION);

MessageBox("TARGETDISK: " + TARGETDISK , INFORMATION);

MessageBox("SRCDIR : " + SRCDIR , INFORMATION);

end;

0 Kudos

(6) Replies
Jenifer
Flexera Alumni

Hi @kumar_shilp ,

 

With the same script you had posted,i could see all values been displayed in message box other than szInstallDir .Since it is a userdefined variable not filled with any value.

 

About why INSTALLDIR /TARGETDIR isn't getting filled,you can check it on:

  • General Information->INSTALLDIR ->What is the value given here?The same will be applied for both INSTALLDIR /TARGETDIR
  • You can also have a look in Directory table under Direct Editor view.You should be able to see values of these there as well.

Hope you are asking developer document for Install Script language reference:

https://helpnet.flexerasoftware.com/installshield21helplib/Subsystems/installshield21langref/helplibrary/LangrefHome.htm?

 

Thanks,

Jenifer

0 Kudos

Thanks Jenifer

PFA of General information and Directory Editor. Are you asking to change directory editor to value as in General information.

Note : Able to fetch installdir and targetdir during un-installation.

Thanks

Gopi.S

0 Kudos

Hi @kumar_shilp,

You should be able to get the values for INSTALLDIR and TARGETDIR from OnFirstUIAfter() call.

function OnFirstUIAfter()
begin
	MessageBox("INSTALLDIR:" + INSTALLDIR,INFORMATION);
	MessageBox("TARGETDIR: " + TARGETDIR , INFORMATION);
end;

I have created a new InstallScript MSI project and it seem to work fine there. I have tried this on InstallShield 2019.

Let us know if you can try the same on a separate/new InstallScript MSI project? just to find out if there is some kind of additional configuration which is causing it not to work.

Thanks.

0 Kudos

Hi @kumar_shilp ,

 

From the snapshots things seem to be fine other than somewhere else it is being reset.If you could share the InstallShield files(.ism & support files if required) it would be helpful to assist you with.

If you would like to share as private view,you can send attachments via private message feature of this forum.

 

Thanks,

Jenifer

0 Kudos

Hi,

Yes I am using Installscript MSI Project and end product is MSI(Not an exe). Since its MSI I have to set InstallScript User Interface Type to New Style (Requires windows installer 4.5). PFA for more info.

0 Kudos

Hi @kumar_shilp ,

 

Thanks for the additional information.With New Style (InstallScript Engine as an Embedded UI Handler) option being set could see the issue that you are facing:

Few things in detail to elaborate the cause:

The following is the order of events that take place with installscript msi setup:

If the .msi package installation is successful, the Windows Installer engine calls back into ISSetup.dll. ISSetup.dll then launches the following events:
  a. OnInstallFilesActionAfter
  b. OnFeaturesInstalled (Any feature installed and uninstalled events are run at this point.)
  c. OnMoved
  d. OnXxxUIAfter (where Xxx is First, Maint, Admin, Patch, Resume, etc.)
  e. OnEnd

 

As well there are few limitations/issues with this new style user interface type-one relevant limitation would  be:

MsiGetTargetPath and MsiSetTargetPath

The Windows Installer MsiGetTargetPath and MsiSetTargetPath functions do not work correctly in the new style if they are in event-driven script. These functions rely on the Directory Manager having been initialized by the Windows Installer costing actions. In new-style InstallScript MSI installations, Windows Installer costing is not performed. Thus, MsiGetTargetPath fails to return any path information, and MsiSetTargetPath fails to set the requested target path. In both cases, Windows Installer logs messages in a verbose log if either of these functions are called.

To update installation paths, use FeatureSetTarget.

Note that MsiGetTargetPath and MsiSetTargetPath can be called through InstallScript custom actions that are sequenced after CostFinalize in the Installation Execute sequence.

 

For more details:https://helpnet.flexerasoftware.com/installshield19helplib/helplibrary/ISMSIExternalVsEmbedded.htm#SpecifyingInstallationInfo_1385487388_1037936

 

So from this it is clear that the specific path related queries might fail if it is from even-driven(OnFirstUIAfter) script.To get rid of this ,you can try installscript based custom actions which can be sequenced after CostFinalize.

 

Hope it helps,

Thanks,

Jenifer

0 Kudos