Old 15th November 2010, 17:09   #1
Noude
Junior Member
 
Join Date: Aug 2010
Posts: 40
LineFind *

Hello !

I have a problem, my internship will be completed soon and I'm stuck on a very small thing...

In a folder I have a number 'n' a files.xml

In these files I have to replace a line (the 6th) "<storeref refid="st1"/>" by "<storeref refid="store1"/>".

So I'm doing that but it's doesn't work, I have to give a name of file ='(

PHP Code:
Section
${LineFind"C:\k3\studies\config\studies\*"         ""         "6"     "DeleteLines"
${LineFind"C:\k3\studies\config\studies\*"         ""         "6"     "WriteToFile"
SectionEnd

Function WriteToFile
FileWrite $R4 
"<storeref refid=$\"store1$\"/>$\r$\n"
Push $0
FunctionEnd

Function DeleteLines
StrCpy 
$0 SkipWrite
Push 
$0
FunctionEnd 
Can you help me please ? Thanks a lot !
Noude is offline   Reply With Quote
Old 15th November 2010, 19:36   #2
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Read the manual. You aren't using it properly (namely the contents of your callback function).

Stu
Afrow UK is offline   Reply With Quote
Old 16th November 2010, 10:05   #3
Noude
Junior Member
 
Join Date: Aug 2010
Posts: 40
Hello,

I have already read the manual 10 times but I really do not see how to use globbing in the LineFind function, I can not just put *?

I have this now:

Section ;File.xml: "st1" or "store1" ?

${LineFind} "C:\k3\studies\config\studies\*" "" "1:-1" "Replace"

SectionEnd



Function Replace

StrCpy $1 $R9
${WordReplace} '$R9' 'st1' 'store1' '+*' $R9
StrCmp $1 $R9 +2
IntOp $R0 $R0 + 1
Push $0

FunctionEnd

And it works if I put a name of file, but not with a *...
Noude is offline   Reply With Quote
Old 16th November 2010, 10:26   #4
Noude
Junior Member
 
Join Date: Aug 2010
Posts: 40
Hey, it's OK now, but it's fat I think ^^

Section ;File.xml: "st1" or "store1" ?

FindFirst $0 $1 C:\k3\studies\config\studies\*.xml
loop:
StrCmp $1 "" done
DetailPrint $1
${LineFind} "C:\k3\studies\config\studies\$1" "" "1:-1" "Replace"
FindNext $0 $1
Goto loop
done:
FindClose $0

SectionEnd

Function Replace

StrCpy $1 $R9
${WordReplace} '$R9' 'st1' 'store1' '+*' $R9
StrCmp $1 $R9 +2
IntOp $R0 $R0 + 1
Push $0

FunctionEnd
Noude is offline   Reply With Quote
Old 16th November 2010, 13:21   #5
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
I'm pretty sure you could just do this:
StrCpy $R9 `<storeref refid="store1"/>$\r$\n`

Stu
Afrow UK is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast 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