Archive: Replace line in severals files located in subdirs.


Replace line in severals files located in subdirs.
Hi,

I'm trying to set my uinstaller to replace a line in several files located in subdirs. For ex.

c:\Dir1\file1.car
c:\Dir2\File2.car
c:\Dir3\File3.car

Each file has a line that contains a unique string not found on any other line in the file. I'd like to replace this line with a common string for all files.

I tried Instructor's script from http://forums.winamp.com/showthread....e+text+in+file
but it didn't seem to work. I get a the following error

!insertmacro: Locate
Error: command Function not valid in section


I downloaded the header files and placed this in the same directory as my NSIS script.


Hi!

These header files are already included in the standard NSIS install package. They don't need to be downloaded separately.

The documentation shows how to use it.

http://nsis.sourceforge.net/Docs/AppendixE.html#E.1.2

Sample:


!include FileFunc.nsh
!insertmacro Locate

Section
${Locate} "[Path]" "[Options]" "fnc"
SectionEnd
Function fnc
...
FunctionEnd


Cheers

Bruno

Thanks I was able to get the functions working but I can't seem to use it during the uninstall section. Also, I need to replace an entire line based on searching on a string in each file.

How would I be able to use this function: (http://nsis.sourceforge.net/Replace_...ecified_string)

but apply it to all *.car files in several subdirs?


Hi hdtvrocks!

To use these functions in the uninstaller you have to use it with un.


!include FileFunc.nsh
!insertmacro un.Locate

Section un.Install
${un.Locate} "[Path]" "[Options]" "fnc"
SectionEnd
Function fnc
...
FunctionEnd


Just connect Locate, LineFind and WordFind/WordReplace functions.

Have fun!

Cheers

Bruno