@echo off
title Truerife HTML File Maker
color f8
:rstart
cls
title Truerife HTML File Maker
if exist mknew\ld.cmd call mknew\ld.cmd
if exist mknew\ld.cmd title Truerife HTML File Maker ^| (Previously %ld%)
if not exist mknew mkdir mknew
:vars
set pname=0
set outfile=0
set sessions=0
set rprograms=Our emails have recommendations for the latest colds and flus.
set intrating=0
set rating=0
set appl=Qx2 bulb with ground pad behind back or under feet
set ytlink=0
set yttitle=0
set yn1=y
set trl=0
:start
cls
:pname
cls
color f0
echo Program name:
set /p pname=
if "%pname%"=="0" goto pname
set outfile=%pname%.html
set trl=%pname%
title Truerife HTML File Maker ^| %pname%
if exist mknew\ld.cmd title Truerife HTML File Maker ^| %pname% (Previously %ld%)
:sessions
cls
color f8
echo Sessions:
set /p sessions=
if "%sessions%"=="0" goto sessions
if not "%sessions%"=="load" echo set sessions=%sessions%>mknew\sessions.cmd
if "%sessions%"=="load" call mknew\sessions.cmd
:rprograms
cls
color f8
echo Related programs [Our emails have recommendations for the latest colds and flus.]:
set /p rprograms=
if not "%rprograms%"=="load" echo set rprograms=%rprograms%>mknew\rprograms.cmd
if "%rprograms%"=="load" call mknew\rprograms.cmd
:rating
cls
color f0
echo Rating:
set /p rating=
if "%rating%"=="0" goto rating
if "%rating%" GTR "5" goto rating
:application
cls
color f8
echo Application [Qx2 bulb with ground pad behind back or under feet]:
set /p appl=
if not "%appl%"=="load" echo set appl=%appl%>mknew\appl.cmd
if "%appl%"=="load" call mknew\appl.cmd
:ytlink
cls
color f8
echo YouTube link:
set /p ytlink=
if "%ytlink%"=="0" goto ytlink
if not "%ytlink%"=="load" echo set ytlink=%ytlink%>mknew\ytlink.cmd
if "%ytlink%"=="load" call mknew\ytlink.cmd
:yttitle
cls
color f8
echo YouTube video title:
set /p yttitle=
if "%yttitle%"=="0" goto yttitle
if not "%yttitle%"=="load" echo set yttitle=%yttitle%>mknew\yttitle.cmd
if "%yttitle%"=="load" call mknew\yttitle.cmd
:trl
cls
color f0
set trltxt=%trl%.trl
if exist "%trl%.trl" set trltxt=%trl%.trl exists!
if exist "%trl%.trl" color f8
if not exist "%trl%.trl" color f0
echo TRL file name, without extension [%trltxt%]:
set /p trl=
if "%trl%"=="0" goto trl
set frq=%trl%.frq
set trl=%trl%.trl
:outfile
cls
color f8
set pnametxt=%pname%.html
if exist "html\%outfile%" set pnametxt=%outfile% already exists, and may be overwritten!
echo Output file [%pnametxt%]:
set /p outfile=
set preoutfile=%outfile%
set outfile=html\%outfile%
:commit
cls
color f8
echo Ready to commit changes?
echo Program Name: %pname%
echo Sessions: %sessions%
echo Related Programs: %rprograms%
echo Rating: %rating% stars
echo Application: %appl%
echo YouTube Link: %ytlink%
echo YouTube Video Title: %yttitle%
echo TRL File: %trl%
if exist "%trl%" echo 	- TRL file found!
if not exist "%trl%" echo 	- TRL file not found!
if exist "%frq%" echo 	- FRQ file found!
if not exist "%frq%" echo 	- FRQ file not found!
echo Output File: %preoutfile%
set /p yn1=[Y/n] 
if "%yn1%"=="y" goto y1
if "%yn1%"=="Y" goto y1
if "%yn1%"=="n" goto rstart
if "%yn1%"=="N" goto rstart
goto commit

:y1
cls
:mkhtml
echo ^<html^>>"%outfile%"
echo 	^<head^>>>"%outfile%"
echo 		^<link rel="stylesheet" href="css/main.css" type="text/css" /^>>>"%outfile%"
echo 	^</head^>>>"%outfile%"
echo 	^<body^>>>"%outfile%"
echo 		^<meta name="viewport" content="width=device-width, initial-scale=1.0" /^>>>"%outfile%"
echo 		^<h1^>%pname%^</h1^>>>"%outfile%"
echo 		^<hr /^>>>"%outfile%"
echo 		^<p^>^<strong^>Sessions:^</strong^> %sessions%^</p^>>>"%outfile%"
echo 		^<p^>^<strong^>Related programs:^</strong^> %rprograms%^</p^>>>"%outfile%"
if "%rating%"=="1" echo 		^<p^>^<strong^>Feedback rating:^</strong^> ^<span^>^&#9733;^</span^>^</p^>>>"%outfile%"
if "%rating%"=="2" echo 		^<p^>^<strong^>Feedback rating:^</strong^> ^<span^>^&#9733;^&#9733;^</span^>^</p^>>>"%outfile%"
if "%rating%"=="3" echo 		^<p^>^<strong^>Feedback rating:^</strong^> ^<span^>^&#9733;^&#9733;^&#9733;^</span^>^</p^>>>"%outfile%"
if "%rating%"=="4" echo 		^<p^>^<strong^>Feedback rating:^</strong^> ^<span^>^&#9733;^&#9733;^&#9733;^&#9733;^</span^>^</p^>>>"%outfile%"
if "%rating%"=="5" echo 		^<p^>^<strong^>Feedback rating:^</strong^> ^<span^>^&#9733;^&#9733;^&#9733;^&#9733;^&#9733;^</span^>^</p^>>>"%outfile%"
echo 		^<!-- For convenience while editing: Qx2 bulb with ground pad under feet --^>>>"%outfile%"
echo 		^<p^>^<strong^>Application:^</strong^> %appl%^</p^>>>"%outfile%"
echo 		^<p class="subtitle"^>Links^</p^>>>"%outfile%"
echo 		^<ul^>>>"%outfile%"
echo 			^<li^>^<a href="%ytlink%"^>%yttitle%^</a^>^</li^>>>"%outfile%"
echo 			^<li^>^<a href="http://truerife.com/products-2.html"^>Store^</a^>>>"%outfile%"
echo 			^<li^>^<a href="mailto:truerife@aol.com"^>Submit Feedback^</a^>^</li^>>>"%outfile%"
echo 			^<li^>^<a href="http://truerifeftp.com"^>Online Support^</a^>^</li^>>>"%outfile%"
echo 			^<li^>^<a href="http://frequencyprotocolservices.com/"^>Additional Resources^</a^>^</li^>>>"%outfile%"
echo 		^</ul^>>>"%outfile%"
echo 	^</body^>>>"%outfile%"
echo ^</html^>>>"%outfile%"
:mktrl
cls
set /p trlimg=<"%trl%"
del /f /q "%trl%"
echo %trlimg%>"%trl%"
echo link=%ytlink%>>"%trl%"
echo html=%preoutfile%>>"%trl%"
:mklog
echo DONE : %trl% // %preoutfile%>>D:\Files\Desktop\html-log.txt
echo set ld=%preoutfile%>>mknew\ld.cmd
:donemsg
cls
echo - HTML file %preoutfile% created.
echo - TRL file %trl% reconstructed.
echo Press any key to make another HTML file, or close this window to exit.
pause>nul
goto rstart