freebendy
17th September 2006 12:26 UTC
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?
freebendy
18th September 2006 03:26 UTC
Anybody can help me?
Animaether
18th September 2006 17:42 UTC
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.
Joel
18th September 2006 19:51 UTC
Originally posted by Animaether
as for the XML, look up FileOpen, FileRead, FileWrite, FileClose.
Why? There are a few XML plugins for parsing XML :)
Animaether
18th September 2006 20:40 UTC
because if all he needs it to add that line, then he doesn't need the plugins %)
freebendy
19th September 2006 02:37 UTC
$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
CrushBug
19th September 2006 04:06 UTC
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. :)
freebendy
19th September 2006 04:25 UTC
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!
Animaether
19th September 2006 12:35 UTC
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.
freebendy
21st September 2006 02:14 UTC
Thanks!And more thx to Joel!:)