- NSIS Discussion
- the use of strReplace
Archive: the use of strReplace
ssam
30th May 2008 09:32 UTC
the use of strReplace
if i use
${StrReplaceV4} $Var "replace" "with" "in string"
i get the following error
Invalid command: ${StrReplaceV4}
and if i use
!insertmacro StrReplaceV4
${StrReplaceV4} $Var "replace" "with" "in string"
i get this error
macro named "StrReplaceV4" not found!
so how i can use this?
on this link
http://nsis.sourceforge.net/StrReplace_v4
i read nothing about what i need to use this function
Red Wine
30th May 2008 09:58 UTC
Better use the included StrFunc header. e.g.
!include "StrFunc.nsh"
${StrRep}
etc.
Read the included doc strfunc.txt
ssam
30th May 2008 10:48 UTC
i used it
${StrRep} $cfg_patched "$template" "$ServerDB" "$Hostname"
i get the following Error
!insertmacro: macro "FUNCTION_STRING_StrRep" requires 0 parameter(s), passed 4!
Error in script
in strFunc.txt
is the following example
Example:
${StrRep} $0 "This is just an example" "an" "one"
[____________()_______]
$0 = "This is just one example"
what is wrong ?
Red Wine
30th May 2008 10:55 UTC
Did you add the single line ${StrRep} below the line !include "StrFunc.nsh"??
ssam
30th May 2008 11:04 UTC
no, but now
!include StrFunc.nsh ${StrRep}
but i have an error again
i dont understand how i must define it
Afrow UK
30th May 2008 11:22 UTC
!insertmacro StrRep after you !include StrFunc.nsh most probably.
Stu
ssam
30th May 2008 11:33 UTC
!include StrFunc.nsh
!insertmacro StrRep
!insertmacro: StrRep
!insertmacro: macro named "StrRep" not found!
Red Wine
30th May 2008 11:57 UTC
Certainly it's a complicated documentation, however if I can figure it,
everybody can do it too. ;)
!include StrFunc.nsh
${StrRep}
......
......
Function or Section
${StrRep} $0 "This is just an example" "an" "one"
$0 = "This is just one example"
ssam
3rd June 2008 06:49 UTC
ah now its clear
false
!include StrFunc.nsh ${StrRep}
right
!include StrFunc.nsh
${StrRep}
ssam
3rd June 2008 08:30 UTC
now i have another question
in the Files, i have placeholder for the Strings i want to replace.
These placeholder are declared as variables like $Server.
if i use StrRep
${StrRep} $ac.jnlp_patched "$ac.jnlp_template" "$Server" "$Server" #Ersetzen des Platzhalters $Server mit dem Inhalt der Variablen $Server
i get these warnigs
unknown variable/constant "ServerDB" detected, ignoring (macro:FUNCTION_STRING_StrRep_Call:7)
unknown variable/constant "DB" detected, ignoring (macro:FUNCTION_STRING_StrRep_Call:7)
unknown variable/constant "User" detected, ignoring (macro:FUNCTION_STRING_StrRep_Call:7)
unknown variable/constant "Server" detected, ignoring
the installer replace the strings correctly, but
is this critical? or can i fix this?
Red Wine
3rd June 2008 09:08 UTC
Assuming that the variables are declared properly, I guess you should add them above from the !include StrFunc.nsh.
ssam
3rd June 2008 10:19 UTC
ok thats correkt, thanks