I Am Making A Batch Program For My Other Program "Super Command Promt" (Check it out on pastebin its really good!) And I Noticed It Was A Bit Tricky To Make Plugins For It So I Decided To Start Working On A Simple Compiler To Make It Easier To Make Plugins, But I Cant Seem To Get It To Work! I Open The File Type The Command:
compile test.txt test.scmd
But It Wont Work It Just Exits Without A Error Instead Of Making The File And Going Going Back To The Prompt Screen
Heres the Script:
REM Made By LiamBogur
REM To install copy into notepad and press save as select all files and save it as "SCMDCOMPILER.bat"
REM Feel free to message me or email me at: liamhmccracken@gmail.com (I dont check my email much so try messaging me first)
cls
@echo off
set Version=1.0.0
title Super Command Prompt Plugin Compiler
echo Super Command Prompt Plugin Compiler [Version %Version%]
echo.
:A
set CommandA=
set Command=
set CommandB=
set CommandC=
set /p CommandA=^>
for /f "tokens=1" %%i in ("%CommandA%") do set Command=%%i
for /f "tokens=2" %%i in ("%CommandA%") do set CommandB=%%i
for /f "tokens=3" %%i in ("%CommandA%") do set CommandC=%%i
if /I %Command%==HELP echo Compiler ^| HELP Displays This Message
if /I %Command%==HELP echo Compiler ^| COMPILE [inputfile] [outputfile] Compiles The Input File Into SCMD Format (eg. input.txt output.scmd)
if /I %Command%==HELP echo Compiler ^| EXIT Exits The Compiler
if /I %Command%==HELP echo Commands ^| COMMAND [command] [commands] Makes The Command "command" And Makes It Run "commands"
if /I %Command%==HELP echo Commands ^| RUN [commands] Run Some Commands In Batch
if /I %Command%==HELP echo Commands ^| COMMENT [comment] Adds A Comment To Your File
if /I %Command%==HELP echo Commands ^| HELP [message] Adds That Message To PHELP (eg."HELP Restart Restarts The Computer")
if /I %Command%==EXIT exit
if /I %Command%==COMPILE goto B
goto A
:B
echo Decoding %CommandB%.
for /f "delims=*" %%i in (%CommandB%) do (
set WordN=0
for /f "tokens=*" %%u in ("%%i") do (
set /A WordN+=1
if %WordN%==1 (
set CCommand=0
if /I %%u==COMMAND (
set CCommand=1
set LineO=if ^%A^%==2 if /I ^%Command^%==
)
if /I %%u==RUN (
set CCommand=2
set LineO=call
)
if /I %%u==COMMENT (
set CCommand=3
set LineO=rem
)
if /I %%u==HELP (
set CCommand=4
set LineO=if ^%A^%==2 if /I ^%Command^%==PHELP echo %CommandC:~0,-5% ^^^|
)
) else (
if CCommand==1 (
set LineO=%LineO%%%u
) else (
set LineO=%LineO% %%u
)
)
echo %LineO%>>C:\Users\Public\Temp.txt
)
mv C:\Users\Public\Temp.txt %CommandC%
goto A
I really need help with this one!
Edit 1: Heres the code for test.txt:
COMMENT Lol this is cool
COMMAND test Lol 123 456
HELP Oh No!
And Heres What Its Meant To Look Like Compiled
REM Lol this is cool
if %A%==2 if /I %Command%==test Lol 123 456
if %A%==2 if /I %Command%==PHELP echo TEST ^| Oh No!
I figured out that for some reason, for my specific program, nested for loops were being a bit buggy. They would just behave randomly and didn't really work, so I created a function, put my second for loop in there, and just had the first loop call the function. Then, it worked perfectly!