CharReplace Example

InstallShield 2016 » InstallScript Language Reference

Note • To call this function in a Basic MSI setup, you must first create a custom action for the entry-point function, execute the custom action in a sequence or as the result of a dialog's control event, and then build the release.

//---------------------------------------------------------------------------

//

//  InstallScript Example Script

//

//  Demonstrates the CharReplace function.

//

//  This sample shows a sample path string before and after replacing

//  every backslash character with a forward slash.

//

//---------------------------------------------------------------------------

 

function OnBegin( )

    STRING path_to_convert;

begin

 

// example path to convert

path_to_convert = FOLDER_COMMON_APPDATA;

 

MessageBox("Path before conversion: " + path_to_convert,

    INFORMATION);

 

// replace backslashes with forward slashes

CharReplace(path_to_convert,

    STRTOCHAR('\\'), STRTOCHAR('/'), 0);

 

MessageBox("Path after conversion: " + path_to_convert,

    INFORMATION);

 

end;