Friday, May 16, 2008

Add HTP.P to an existint HTML file (batch program)

Well, this is something that might help you, if like me you tend to create a lot of store procedures that use HTP.P to output HTML code to the user's browse.

It is a simple batch program that will take an existing HTML or Text file and add the htp.p command to each line.

You need to save the file as something.BAT and then run it on the command line of your windows pc, passing the name of your html file as follows:

something.bat mypage.html

here is the code:

:: SCRIPT START

@Echo Off

SET beggining_text=htp.p^('

SET end_text='^) ;

IF EXIST C:\TmpFile.txt DEL /Q F TmpFile.txt

FOR /F "delims=~" %%L IN (%1) Do (

Echo %beggining_text% %%L '^);>>TmpFile.txt

)

DEL /Q F %1

REN TmpFile.txt %1

:: SCRIPT END

No comments: