Winamp & Shoutcast Forums

Winamp & Shoutcast Forums (http://forums.winamp.com/index.php)
-   NSIS Discussion (http://forums.winamp.com/forumdisplay.php?f=65)
-   -   How to modify a xml config file according to the installation type? (http://forums.winamp.com/showthread.php?t=255666)

freebendy 17th September 2006 11:26

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 02:26

Anybody can help me?

Animaether 18th September 2006 16:42

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 18:51

Quote:

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 19:40

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

freebendy 19th September 2006 01:37

$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 03:06

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 03:25

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 11:35

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 01:14

Thanks!And more thx to Joel!:)


All times are GMT. The time now is 04:08.

Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.