Skip to content
⌘ NSIS Forum Archive

StrRep outside of sections

4 posts

Veit#

StrRep outside of sections

I'm having trouble of using StrRep from StrFunc.nsh. What I wanted to do is converting a Version string from 1.2.3 to 1_2_3 to use in the OutFile Attribute, but it just won't work. Is there a way to use StrRep outside a section?
My code looks like this:


!define PRODUCT_VERSION "1.2.3"
!include "StrFunc.nsh"
${StrRep}

${StrRep} $0 "${PRODUCT_VERSION}" "." "_"
OutFile "${InstallerPath}\Setup\Application_$0_setup.exe"

TiA
isawen#
Hi Veit,

Check this article http://nsis.sourceforge.net/Invoking_NSIS_run-time_commands_on_compile-time.
You should be able to perform what you desire.

Isawen
Veit#
isawen:
Thanks for the reply. I was hoping for an easier solution.
I think I will the just define two Product Versions, one with dots and one with underscores.

Veit
isawen#
You cannot use StrRep outside sections.
The easly way it will be for you to have two declarations of the version.