Archive: macro problem using file operations


macro problem using file operations
i'm trying to write 3 macros to simplify writing a file.

here they are.

!macro FOpen FileName Mode
Push $0
FileOpen $0 ${FileName} ${Mode}
!macroend

!macro FWriteLine Text
FileWrite $0 ${Text}
FileWriteByte $0 "13"
FileWriteByte $0 "10"
!macroend

!macro FClose
FileClose $0
Pop $0
!macroend


when i try to use them in a script:


!insertmacro FOpen "$WINDIR\php.cmd" "w"
!insertmacro FWriteLine "@ECHO OFF"
!insertmacro FWriteLine "SET PHPFILE=%1"
!insertmacro FWriteLine "C:\WINNT\PHPCLI\PHP.EXE -c C:\WINNT\PHPCLI\ %PHPFILE% %2 %3 %4 %5 %6 %7 %8 %9"
!insertmacro FClose


i get an error on the first FWriteLine telling me
FileWrite expects 2 parameters, got 3

I am at a total loss for why this is not working.

any help is appreciated.

-Tim


found the problem myself.
!macro FWriteLine Text
FileWrite $0 ${Text}
FileWriteByte $0 "13"
FileWriteByte $0 "10"
!macroend

should be
!macro FWriteLine Text
FileWrite $0 "${Text}"
FileWriteByte $0 "13"
FileWriteByte $0 "10"
!macroend