cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
AceBear
Level 4

How to use SELECTED_LANGUAGE as a condition in Custom Action

Jump to solution

I have a InstallScript MSI project. The Installation supports multiple languages. So at the end of the installation, the installer needs to run a batch file which is corresponding to the user selected language. For example if user selected French in the language dialog, the batch file French.bat will be executed; If user selects English, the English.bat will be executed.

1) What is the best way to do this?

2) I treid to create a Custom Action with the type of Launch EXE  and set the Batch file name as the parameter for the cmd.exe . In this case, I need to use SELECTED_LANGUAGE as the condition for running the Custom Action. I tried the following condition: 

(SELECTED_LANGUAGE=ISLANG_FRENCH_STANDARD) AND (REMOVE<>"ALL") AND (NOT INSTALLED) AND (NOT UPGRADINGPRODUCTCODE)

However, the cmd.exe is called when non French language is selected. It looks like SELECTED_LANGUAGE=ISLANG_FRENCH_STANDARD does not work in custom actions. I verified the SELECTED_LANGUAGE in Installscript and it is French in this test case.

Can SELECTED_LANGUAGE be used as a condition in Custom Action? and how?

Thank you.

 

Labels (1)
0 Kudos
(1) Solution

Hi @AceBear ,

yes you can construct the path like that, but no need to put square bracket

sLangFileFullPath = ProgramFiles64Folder + "\\French.bat";

See whether you are able to execute the batch file using LaunchAppAndWait

Some time LaunchAppAndWait looks for the batch file again in the Program Files 86 folder, in that case you can disable the WOW64 redirection by calling below methods

Disable(WOW64FSREDIRECTION);

LaunchAppAndWait .....

Enable(WOW64FSREDIRECTION)

 

View solution in original post

0 Kudos
(4) Replies
banna_k
Revenera
Revenera

Hi @AceBear ,

 

It cannot be used in the custom action condition, its a variable defined in Installscript, so only used in Installscript:

https://helpnet.flexerasoftware.com/installshield21helplib/Subsystems/installshield21langref/helplibrary/LangrefSELECTEDLANGUAGE.htm#langref_variabledata_2139200659_1023095

As you are using InstallScript MSI, you can write the code to run the corresponding batch file in installscript events based on the  SELECTED_LANGUAGE, or even through a Installscript custom action.

0 Kudos

Thank you @banna_k 

The challenge for me is that these Batch files are copied to [INSTALLDIR] which is definded as [ProgramFiles64Folder]\subfolder . I want to use the following function to launch the Batch files, but I am not sure if I can construct the sLangFileFullPath like the following?

sLangFileFullPath =   [ProgramFiles64Folder] + "\\French.bat";

LaunchAppAndWait(sLangFileFullPath , "abc", LAAW_OPTION_WAIT_INCL_CHILD);

0 Kudos

Hi @AceBear ,

yes you can construct the path like that, but no need to put square bracket

sLangFileFullPath = ProgramFiles64Folder + "\\French.bat";

See whether you are able to execute the batch file using LaunchAppAndWait

Some time LaunchAppAndWait looks for the batch file again in the Program Files 86 folder, in that case you can disable the WOW64 redirection by calling below methods

Disable(WOW64FSREDIRECTION);

LaunchAppAndWait .....

Enable(WOW64FSREDIRECTION)

 

0 Kudos

Thank you. This works.

0 Kudos