domino_is_software
Posts: 3
Joined: Wed May 28, 2008 1:52 pm

Replacing Text in a String using a custom action

Hi

I am new to advanced installer and have a question about custom actions...

I am trying to replace the backslah characters in a directory name with forward slashes (the java logger we use requires "/" as the seapartors). I do not seem to be able to achieve this using a Vb Script custom action ( i am using inline script). How would this be done?

I have tried the following, which does not work:

Code: Select all

logdir=System.Property("APPLOGDIR"):Replace(logdir, "\", "/"):System.Property("APPLOGDIR")=logdir
I get complaints about parentheses. If I remove the parentheses, I get errors about expected end of statement!

Thanks
domino_is_software
Posts: 3
Joined: Wed May 28, 2008 1:52 pm

Re: Replacing Text in a String using a custom action

The code should read

logdir=Session.Property("APPLOGDIR"):Replace(logdir, "\", "/"):Session.Property("APPLOGDIR")=logdir

If the function is run from a vbs file i can display a message box with the session property and the logdir variable, however the replace function does not work! so i still have the backslashes in the directory name

Any ideas?

Thanks
schwarzsurfer
Posts: 49
Joined: Wed Feb 10, 2016 11:06 am

Re: Replacing Text in a String using a custom action

How? I need the same functionality... can you tell me the correct statement?

Thanks!
Ich weiß, dass ich nichts weiß!
Sorin
Posts: 663
Joined: Mon May 08, 2017 1:03 pm

Re: Replacing Text in a String using a custom action

Hello,

This could be implemented using a "Execute Inline Script Code" custom action containing the following code:

Code: Select all

str=Session.Property("PROP")
Session.Property("PROP")=Replace(str,"\","/")
Where PROP is the property containing the slash.

Please let me know if you have any other questions.

Best regards,
Sorin
Sorin Stefan - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”