Archive: How to modify a xml config file according to the installation type?


How to modify a xml config file according to the installation type?And write the REG?
I have to modify a xml config file according to the installation type!!If the user chooses to install for the current user I have write "<SetupMode>0</SetupMode>" into the xml file,and if choosing to install for all user it will be "<SetupMode>1</SetupMode>"!the content xml file is as follow:

<LogScale>1</LogScale>
<LogFileMaxSize>1</LogFileMaxSize>
<LogPath>Log</LogPath>
<LogFileMaxTimeSpan>1</LogFileMaxTimeSpan>
<LogFileLife>15<LogFileLife>

i will add my modify at the end of the file!!
how to do it?

And:
I also want to write the Reg according to the installation type!
so I use this to record the installation type:
Function PageLeaveFunc
ReadINIStr $0 "$PLUGINSDIR\selection.ini" "Field 1" "State"
FunctionEnd

then i use :
StrCmp $0 1 0 No1
SetShellVarContext current
StrCpy $PURK "HKCU"
Goto No2
No1:
SetShellVarContext all
StrCpy $PURK "HKLM"
No2:
to assign the location of reg i will write.But it show mistake in the line:StrCpy $PURK "HKCU"

what is the wrong?


Anybody can help me?


is $PURK a variable you deefined? If not - that would be why as far as the second error might go.

as for the XML, look up FileOpen, FileRead, FileWrite, FileClose.


Originally posted by Animaether
as for the XML, look up FileOpen, FileRead, FileWrite, FileClose.
Why? There are a few XML plugins for parsing XML :)

because if all he needs it to add that line, then he doesn't need the plugins %)


$PURK is defined by me!
I have passed this problem !
But I thinked that NSIS is weak in modifying the exist file!Locating the place you want to insert is inconvenient


As long as you have "var PURK" somewhere, then sure, its your variable. But, that is where the compile error is then that is where the problem lies.

By "passed", do you mean that you have given up?

I think its pretty silly of you to dis NSIS for being weak, when you cannot get your script to compile. That is like blaming Visual C when your C code doesn't compile and calling it weak on file handling. :)


CrushBug:
By "Passed",i mean i have solved the problem!!My En is not gOOD!:(!!

And i am not to dis NSIS for being weak!!!
I like NSIS! It is powerful!


as for "Locating the place you want to insert is inconvenient" - check Joel's comment, then - there are XML parsing plugins for NSIS which would make this easier.


Thanks!And more thx to Joel!:)