Go Back   Winamp Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 30th May 2008, 08:32   #1
ssam
Member
 
Join Date: May 2008
Posts: 60
the use of strReplace

if i use
code:

${StrReplaceV4} $Var "replace" "with" "in string"


i get the following error

Invalid command: ${StrReplaceV4}


and if i use
code:

!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
ssam is offline   Reply With Quote
Old 30th May 2008, 08:58   #2
Red Wine
Forum King
 
Red Wine's Avatar
 
Join Date: Mar 2006
Location: Ath. GR
Posts: 2,078
Better use the included StrFunc header. e.g.

!include "StrFunc.nsh"

${StrRep}

etc.

Read the included doc strfunc.txt

Quick AVI Creator - Quick and easy convert from DVD/MPEG/AVI/MKV to AVI/MP4/MKV
Quick AVI Creator entirely edited with NSIS and entirely upgraded to Unicode NSIS
Red Wine is offline   Reply With Quote
Old 30th May 2008, 09:48   #3
ssam
Member
 
Join Date: May 2008
Posts: 60
i used it
code:

${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 ?
ssam is offline   Reply With Quote
Old 30th May 2008, 09:55   #4
Red Wine
Forum King
 
Red Wine's Avatar
 
Join Date: Mar 2006
Location: Ath. GR
Posts: 2,078
Did you add the single line ${StrRep} below the line !include "StrFunc.nsh"??

Quick AVI Creator - Quick and easy convert from DVD/MPEG/AVI/MKV to AVI/MP4/MKV
Quick AVI Creator entirely edited with NSIS and entirely upgraded to Unicode NSIS
Red Wine is offline   Reply With Quote
Old 30th May 2008, 10:04   #5
ssam
Member
 
Join Date: May 2008
Posts: 60
no, but now

!include StrFunc.nsh ${StrRep}

but i have an error again

i dont understand how i must define it
ssam is offline   Reply With Quote
Old 30th May 2008, 10:22   #6
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Birmingham, England
Posts: 8,202
!insertmacro StrRep after you !include StrFunc.nsh most probably.

Stu

Need an installer? http://www.afrowsoft.co.uk
Afrow UK is offline   Reply With Quote
Old 30th May 2008, 10:33   #7
ssam
Member
 
Join Date: May 2008
Posts: 60
code:

!include StrFunc.nsh
!insertmacro StrRep



!insertmacro: StrRep
!insertmacro: macro named "StrRep" not found!
ssam is offline   Reply With Quote
Old 30th May 2008, 10:57   #8
Red Wine
Forum King
 
Red Wine's Avatar
 
Join Date: Mar 2006
Location: Ath. GR
Posts: 2,078
Certainly it's a complicated documentation, however if I can figure it,
everybody can do it too.
code:
!include StrFunc.nsh
${StrRep}
......
......
Function or Section
${StrRep} $0 "This is just an example" "an" "one"
$0 = "This is just one example"


Quick AVI Creator - Quick and easy convert from DVD/MPEG/AVI/MKV to AVI/MP4/MKV
Quick AVI Creator entirely edited with NSIS and entirely upgraded to Unicode NSIS
Red Wine is offline   Reply With Quote
Old 3rd June 2008, 05:49   #9
ssam
Member
 
Join Date: May 2008
Posts: 60
ah now its clear

false
!include StrFunc.nsh ${StrRep}

right
!include StrFunc.nsh
${StrRep}
ssam is offline   Reply With Quote
Old 3rd June 2008, 07:30   #10
ssam
Member
 
Join Date: May 2008
Posts: 60
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

code:

${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?
ssam is offline   Reply With Quote
Old 3rd June 2008, 08:08   #11
Red Wine
Forum King
 
Red Wine's Avatar
 
Join Date: Mar 2006
Location: Ath. GR
Posts: 2,078
Assuming that the variables are declared properly, I guess you should add them above from the !include StrFunc.nsh.

Quick AVI Creator - Quick and easy convert from DVD/MPEG/AVI/MKV to AVI/MP4/MKV
Quick AVI Creator entirely edited with NSIS and entirely upgraded to Unicode NSIS
Red Wine is offline   Reply With Quote
Old 3rd June 2008, 09:19   #12
ssam
Member
 
Join Date: May 2008
Posts: 60
ok thats correkt, thanks
ssam is offline   Reply With Quote
Reply
Go Back   Winamp Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump