I'm kind of ... stunned. I've got over 3000 lines of NSIS code right now, but now a strange error occurres in the middle of my program - the value of a variable gets replaced.
Right from the start I've thought, I've mixed up some Pushes and Pops. I've traced the error and limited the code where it occurres.
I'm calling the macro from inside a function:!macro __appendStrToFile _file _mode _string
Push $0
Push $1
Push $2
MessageBox MB_OK "${_string}"
StrCpy $0 "${_file}"
MessageBox MB_OK "${_string}"
StrCpy $1 "${_mode}"
StrCpy $2 "${_string}"
Call __appendStrToFile
Exch 3 # stack: 0, 2, 1, return
Pop $0
Pop $2
Pop $1
!macroend
$0 of myFunc is a file name. Lets say it's C:\file.txt. And let's say ${RB_REG_SCRIPTS} is D:\abc.deFunction myFunc
# write comment to file
${AppendStrToFile} ${RB_REG_SCRIPTS} o "; $0 ${LineBreak}${LineBreak}"
FunctionEnd
The first message box displays: "; C:\file.txt"
The second says: "; D:\abc.de"
I've checked: Only _string changed - all other parameter stay the same ...
As you notice: the semicolon and the space remain, but the file name changed. So, how can it be, that only the value of the variable inside the string changes??
The real value of ${_string} is 82 or 84 chars long - is that a problem? (But it can be displayed without any problems...)
Thanks! 🙂
CJ