Skip to content
⌘ NSIS Forum Archive

AdvReplaceInFile and FileWrite output

3 posts

udden#

AdvReplaceInFile and FileWrite output

using the function AdvReplaceInFile to replace strings in a file, but the output file is unreadable!?
Want to replace dbname in a sql-script.

;copying the .sql file to the install dir here

Push "_DB_NAME_" #text to be replaced
Push "test" #replace with
Push all #replace all occurrences
Push all #replace all occurrences
Push "$INSTDIR\test.sql" #file to replace in
Call AdvReplaceInFile

But the resulting file is unreadable, just jibberish. Any ideas?
evilO#
Hi udden 🙂 !

Well, I've tried your code on a 'dummy' test.sql file, and it does work perfectly... Did you manage to get this working ? Otherwise, could you post your file ?

evilO/Olive
udden#
hey.

after quite some testning, i figured it out a few hours ago.

i simply printed every read, and found out that the file i was using contained some illegal characters in the beginning. when i tried with a new file, it worked like a charm 🙂

thanks for the reply anyways.

cheers