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

SUPPORTDIR placing files in different location

Jump to solution

I am fairly new to InstallShield and I have a project of type Basic MSI and an installscript that should install crystal reports as a prerequisite to my installation using this line LaunchAppAndWait(SUPPORTDIR^ "CR13SP31MSI64_0-10010309.exe", "", LAAW_OPTION_WAIT_INCL_CHILD);

I placed my crystal reports EXE file inside the support files section under behavior and logic and under language independent. 

I have noticed that the reason why my EXE file is not being executed is because the installation is creating 2 folders inside the TEMP folder of the machine I am running installation on, and it is placing my EXE file in one folder and then trying to access the file in the other folder (see attachments). The EXE file is in the folder that starts with 133 but my SUPPORTDIR variable references the folder that starts with FDC. Why is this so and how can I make SUPPORTDIR variable in my InstallScript point to the correct folder.

Labels (1)
0 Kudos
(1) Solution
varul
Revenera Moderator Revenera Moderator
Revenera Moderator

Hi @ttembo,

 Installshield will copy all files to secured location to install the setup.exe, that is the reason you are seeing 2 folder, one for setup.exe and other files one more folder with support files.

 

you can try below code to access supportdir using installscript in BMSI project.

 

function Supportdirtest(hMSI)
    // To Do:  Declare local variables.
STRING szProgram,szCmd,sMySUPPORTDIR;
NUMBER nResult,nvBufferSize;
begin
 
MsiGetProperty(hMSI,"SUPPORTDIR", sMySUPPORTDIR, nvBufferSize);
 
MessageBox("SUPPORTDIR = " + sMySUPPORTDIR, INFORMATION);
 
szProgram = sMySUPPORTDIR ^ "OpenJDK11U-jdk_x64_windows_hotspot_11.0.13_8.msi";
 
nResult = LaunchAppAndWait(szProgram, "", LAAW_OPTION_WAIT);
 
end;

View solution in original post

0 Kudos
(3) Replies
varul
Revenera Moderator Revenera Moderator
Revenera Moderator

Hi @ttembo,

 Installshield will copy all files to secured location to install the setup.exe, that is the reason you are seeing 2 folder, one for setup.exe and other files one more folder with support files.

 

you can try below code to access supportdir using installscript in BMSI project.

 

function Supportdirtest(hMSI)
    // To Do:  Declare local variables.
STRING szProgram,szCmd,sMySUPPORTDIR;
NUMBER nResult,nvBufferSize;
begin
 
MsiGetProperty(hMSI,"SUPPORTDIR", sMySUPPORTDIR, nvBufferSize);
 
MessageBox("SUPPORTDIR = " + sMySUPPORTDIR, INFORMATION);
 
szProgram = sMySUPPORTDIR ^ "OpenJDK11U-jdk_x64_windows_hotspot_11.0.13_8.msi";
 
nResult = LaunchAppAndWait(szProgram, "", LAAW_OPTION_WAIT);
 
end;
0 Kudos

Thanx @varul  this resolved my issue particularly this line MsiGetProperty(hMSI,"SUPPORTDIR", sMySUPPORTDIR, nvBufferSize);

I put it at the beginning of my script after all variable declarations and I am now using sMySUPPORTDIR as my reference to my EXE file in the temp folder instead of SUPPORTDIR which I was using. I'm yet to understand what the function MsiGetProperty is actually doing but all good for now.

0 Kudos
Revenera_Ian
Revenera Moderator Revenera Moderator
Revenera Moderator

Hi @ttembo,

Thank you for your post.

We are happy to hear that @varul's solution resolved this issue. To clarify, with a Basic MSI project, the Basic MSI project is based on Microsoft's Windows Installer technology and Microsoft's Windows Installer engine performs the main installation. Windows Installer (also known as MSI) uses runtime variables known as MSI properties to store values that the installer uses. Public properties have names in all uppercase: MYPUBLICPROPERTY. Private properties have names not in all uppercase: MyPrivateProperty, for example.

In the case of SUPPORTDIR that you reported, InstallScript has a variable named SUPPORTDIR which has a different value than the public MSI property, SUPPORTDIR. Hence, you need to use the Windows Installer API function, MsiGetProperty, which is available in InstallScript, because it was automatically prototyped, to retrieve the value of SUPPORTDIR, the public MSI property, at runtime.

Here are a few links with more information about public versus private MSI properties, for your reference:

https://community.flexera.com/t5/InstallShield-Knowledge-Base/Differences-Between-A-Public-And-Private-Property/ta-p/3949

https://learn.microsoft.com/en-us/windows/win32/msi/public-properties

https://learn.microsoft.com/en-us/windows/win32/msi/private-properties

Please let us know if you have any questions or concerns. Thanks!

0 Kudos