cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Amarjeet
Level 7

Property string manipulation

Hi,

I am working on basic msi project. I am detecteting a product from registry.

I get current version information of product in form of

Application.CurrentVersion.7.11

I save this information in form a property through System Search

I would like to truncate Application.CurrentVersion and show only 7.11 in one of the dialog.

Is there any function available which can enable me to truncate property value.

Thanks in advance.

Regards,

Amarjeet
Labels (1)
0 Kudos
(7) Replies
kayaker
Level 4

Use StrFindEx /StrSub / StrLength function in installscript, also you can optimize below function, extract the keyword "CurrentVersion." to make it common.

something like

function string trim(text)
string szPath;
int nFindResult;
int nLen;
begin

nFindResult = StrFindEx(text,"CurrentVersion.",1);
if (nFindResult > 0) then
nLen=(StrLength("appication"));
StrSub(szPath,text,nLen + nFindResult + 1,StrLength(text)-nLen-nFindResult - 1);
return szPath;
endif;

end;
0 Kudos
Amarjeet
Level 7

My project is Basic MSI. Installscript functions are not available in custom action.

Amarjeet
0 Kudos
kayaker
Level 4

From IS2008 help...

Basic MSI projects have the ability to run InstallScript code in the form of custom actions. As with InstallScript projects, Basic MSI projects take advantage of other robust features provided by InstallShield such as dialog authoring, the ability to call custom actions in standard Windows .dll files, and the ability to specify support files.
0 Kudos
kayaker
Level 4

From IS2010 help...

Determining Which Installation Project Is Right for You

Basic MSI Projects
Basic MSI projects use the Windows Installer service to drive the entire installation, including calls to any custom actions (InstallScript, VBScript, JScript, .exe files, .dll files, managed code).
0 Kudos
Amarjeet
Level 7

When i select new custom action - installscript - In dropdown list of function name i can't see any function name. Its blank.

So how i can use installscript functions in custom action ?

Amarjeet
0 Kudos
Not applicable

• Behavior and Logic ->Installscript. Right Click Files under installscript.
• Select “new script files”. This gives setup.rul, which comes with base skeleton function” MyFunction(hMSI) “.
• Add your code under “MyFunction(hMSI)”
• Go to “Custom Action and Sequence”. Right click “New Installscript”. In the function name field select “MyFunction”
0 Kudos
MSIYER
Level 8

For including Installscript functions as CAs, you need to export the prototype.
That is at the beginning of the script use
"export prototype ";
and then implement your function.
This will expose your Installscript function in the Custom Action Wizard.
0 Kudos