merahul94538
17th April 2003, 00:39
Code is from Archive.What I need to do it to call this script from my main installer file to make changes in my 2 XML files.
This is code in my main installer file but it's not working,i am doing something wrong but can't figure out
In WriteXML I get script,StringA,StringB value coorect but file.name and filnenew.xml comes as null.Please help.
Code attached.
What I need is that I should be able to send sourcefile name,destination file name,string to be replaced,new string from my main installer file to Writexml and get the final output in destination file name. Thank in advance
push "StringA"
push "StringB"
push "file.xml"
push "filenew.xml"
; Some code to adjust settings in XML file.
;
; By Hendri Adriaens.
; HendriAdriaens@hotmail.com
!define TEMP1 $R0 ;Temp variable
!define TEMP2 $R1 ;Temp variable
!define TEMP3 $R2 ;Temp variable
!define TEMP4 $R3 ;Temp variable
;outfile WriteXML.exe
;name WriteXML
; push sourcefile
; push destfile
; push search string
; push new string
function ParseXML
;MessageBox MB_YESNO "This will modify studio.txt and put output to temp.tmp.$\r$\nContinue?" IdNo Quiting
Exch $0 ;newString
MessageBox MB_OK $0
Exch
Exch $1 ;search string
MessageBox MB_OK $1
Exch
Exch $2 ;source file
MessageBox MB_OK $2
Exch
Exch $3 ;destfile
MessageBox MB_OK $3
FileOpen $R0 "$3" "r"
FileOpen $R1 "$4" "w"
MessageBox MB_OK $R0
MessageBox MB_OK $R1
Loop:
FileRead $R0 $R2
StrCmp $R2 "" ExitLoop
push $R2
push $1
Call StrStrH
Pop $R3
StrCmp $R3 $R2 NotFound
FileWrite $R1 '$R3"$1" value="$2" />$\r$\n'
GoTo Loop
NotFound:
FileWrite $R1 $R2
Goto Loop
ExitLoop:
FileClose $R0
FileClose $R1
Quiting:
Quit
functionend
Function StrStrH
;Modified StrStr function from functions.htm
Exch $1
Exch
Exch $2
Push $3
Push $4
Push $5
StrLen $3 $1
StrCpy $4 0
loop:
StrCpy $5 $2 $3 $4
StrCmp $5 $1 done
StrCmp $5 "" done
IntOp $4 $4 + 1
Goto loop
done:
StrCpy $1 $2 $4
Pop $5
Pop $4
Pop $3
Pop $2
Exch $1
FunctionEnd
section
sectionend
This is code in my main installer file but it's not working,i am doing something wrong but can't figure out
In WriteXML I get script,StringA,StringB value coorect but file.name and filnenew.xml comes as null.Please help.
Code attached.
What I need is that I should be able to send sourcefile name,destination file name,string to be replaced,new string from my main installer file to Writexml and get the final output in destination file name. Thank in advance
push "StringA"
push "StringB"
push "file.xml"
push "filenew.xml"
; Some code to adjust settings in XML file.
;
; By Hendri Adriaens.
; HendriAdriaens@hotmail.com
!define TEMP1 $R0 ;Temp variable
!define TEMP2 $R1 ;Temp variable
!define TEMP3 $R2 ;Temp variable
!define TEMP4 $R3 ;Temp variable
;outfile WriteXML.exe
;name WriteXML
; push sourcefile
; push destfile
; push search string
; push new string
function ParseXML
;MessageBox MB_YESNO "This will modify studio.txt and put output to temp.tmp.$\r$\nContinue?" IdNo Quiting
Exch $0 ;newString
MessageBox MB_OK $0
Exch
Exch $1 ;search string
MessageBox MB_OK $1
Exch
Exch $2 ;source file
MessageBox MB_OK $2
Exch
Exch $3 ;destfile
MessageBox MB_OK $3
FileOpen $R0 "$3" "r"
FileOpen $R1 "$4" "w"
MessageBox MB_OK $R0
MessageBox MB_OK $R1
Loop:
FileRead $R0 $R2
StrCmp $R2 "" ExitLoop
push $R2
push $1
Call StrStrH
Pop $R3
StrCmp $R3 $R2 NotFound
FileWrite $R1 '$R3"$1" value="$2" />$\r$\n'
GoTo Loop
NotFound:
FileWrite $R1 $R2
Goto Loop
ExitLoop:
FileClose $R0
FileClose $R1
Quiting:
Quit
functionend
Function StrStrH
;Modified StrStr function from functions.htm
Exch $1
Exch
Exch $2
Push $3
Push $4
Push $5
StrLen $3 $1
StrCpy $4 0
loop:
StrCpy $5 $2 $3 $4
StrCmp $5 $1 done
StrCmp $5 "" done
IntOp $4 $4 + 1
Goto loop
done:
StrCpy $1 $2 $4
Pop $5
Pop $4
Pop $3
Pop $2
Exch $1
FunctionEnd
section
sectionend