PDA

View Full Version : Expanding strings


DamagedGenius
30th December 2006, 15:03
Hello Everyone.

This is a problem that I've defeated by other means, but the other means are slow and painful to look at. What I'm doing is reading some lines of text from an xml file that accompanies my installer. In these lines I have some of the NSIS strings, such as $DESKTOP and such. However when I read these strings in, I just get $DESKTOP, not C:\Documents...

So my question is, is there a function that I can pass these to, to have them expand into the right context? Right now I'm just using WordReplace and it's awkward.

Thanks

kichik
30th December 2006, 15:45
WordReplace is the way to go. NSIS does that on the compiler side, so there's nothing on the installer side you can use.

Red Wine
30th December 2006, 16:13
I'm not sure if I understood the right thing, if you only read a single line that contains only e.g. $DESKTOP this might help:
;Read the string in $0
${TrimNewLines} $0 $0
DetailPrint $0
StrCmp $0 '$$DESKTOP' 0 end
StrCpy $0 '$DESKTOP'
end:
detailprint '$0'