bat program that creates coded messages

December 22, 2010 at 20:56:46
Specs: Vista, Core 2 / 2 gig ram
example

hello world
seddi rofgh

example code:
set /p word_here= hello world
(some parametter here that divides each letter up 'h' by itself and 'e' by itself etc)
(and the converts it into a coded message)

then a program that writes it over to a document
type something here >> hello_world.txt


See More: bat program that creates coded messages

Report •

#1
December 22, 2010 at 22:08:32
Below is a bat that converts text to morse code.
Change the .-. s to what ever letter you want.
You will need a second copy and reverse the the code.
Example
1.bat if %INPUT% == a echo k >>temp.txt
2.bat if %INPUT% == k echo a >>temp.txt
Hope this is of help


cls
:start
set INPUT=
set /P INPUT=Type input: %=%
echo Your input was: %INPUT%
pause
if %INPUT% == a echo .-  >>temp.txt
if %input% == b echo -...  >>temp.txt
if %INPUT% == c echo -.-.  >>temp.txt
if %INPUT% == d echo -..  >>temp.txt
if %INPUT% == e echo .  >>temp.txt
if %INPUT% == f echo ..-.  >>temp.txt
if %INPUT% == g echo --.  >>temp.txt
if %INPUT% == h echo ....  >>temp.txt

if %INPUT% == i echo ..  >>temp.txt
if %INPUT% == j echo .---  >>temp.txt
if %INPUT% == k echo -.-  >>temp.txt
if %INPUT% == l echo .-..  >>temp.txt
if %INPUT% == m echo --  >>temp.txt
if %INPUT% == n echo -.  >>temp.txt
if %INPUT% == o echo ---  >>temp.txt
if %INPUT% == p echo .--.  >>temp.txt
if %INPUT% == q echo --.-  >>temp.txt
if %INPUT% == r echo .-.  >>temp.txt
if %INPUT% == s echo ...  >>temp.txt
if %INPUT% == t echo -  >>temp.txt
if %INPUT% == u echo ..-  >>temp.txt
if %INPUT% == v echo ...-  >>temp.txt
if %INPUT% == w echo .--  >>temp.txt
if %INPUT% == x echo -..-  >>temp.txt
if %INPUT% == y echo -.--  >>temp.txt
if %INPUT% == z echo --..  >>temp.txt
if %INPUT% == 1 echo .----  >>temp.txt
if %INPUT% == 2 echo ..---  >>temp.txt
if %INPUT% == 3 echo ...--  >>temp.txt
if %INPUT% == 4 echo ....-  >>temp.txt
if %INPUT% == 5 echo .....  >>temp.txt
if %INPUT% == 6 echo -....  >>temp.txt
if %INPUT% == 7 echo --...  >>temp.txt
if %INPUT% == 8 echo ---..  >>temp.txt
if %INPUT% == 9 echo ----.  >>temp.txt
if %INPUT% == 0 echo -----  >>temp.txt
if %INPUT% == . echo .-.-.  >>temp.txt
if %INPUT% == , echo --..--  >>temp.txt
if %INPUT% == ? echo ..--..  >>temp.txt
if %INPUT% == ap echo .----.  >>temp.txt
if %INPUT% == ! echo -.-.--  >>temp.txt
if %INPUT% == bs echo -..-.  >>temp.txt
if %INPUT% == - echo -....-  >>temp.txt
if %INPUT% == fs echo -..-.  >>temp.txt

if %INPUT% == ( echo -.--.-  >>temp.txt
if %INPUT% == qt echo .-..-.  >>temp.txt
if %INPUT% == exit goto :final


goto :start
:final
setlocal enabledelayedexpansion
set FINAL=
for /f %%a in (temp.txt) do (
set FINAL=!FINAL!%%a
)
echo %FINAL% >final.txt
::del /q temp.txt
endlocal

exit


Report •

#2
December 23, 2010 at 03:54:43
worldlibrary,

I see you're still flogging that busted code.

http://www.computing.net/answers/pr...


=====================================
Life is too important to be taken seriously.

M2


Report •

#3
December 23, 2010 at 13:25:43
meh it didn't work... it's all kinda weird
if i put something in as the input it doesn't work out right... i'll keep expirementing with it though thx

Report •

Related Solutions

#4
December 23, 2010 at 13:28:03
alright it worked.... but here's the thing... :P i have to press enter every time i want to add a letter :P that's not very efficient... i'll take a look at your site mechanix

Report •

#5
December 24, 2010 at 09:59:58
Pipe it.
echo.|

echo.|if %INPUT% == a echo .-  >>temp.txt
echo.|if %input% == b echo -...  >>temp.txt

Perhaps a free encryption program would better suite your needs


Report •

#6
December 24, 2010 at 11:05:37
Working on a line of input character by character isn't difficult:
SETLOCAL EnableDelayedExpansion
SET /P _inBuff=Text: 
:In
IF NOT DEFINED _inBuff GOTO :EOF
SET _chr=!_inBuff:~0,1!
CALL :ProcChar !_chr!
SET _inBuff=!_inBuff:~1!
GOTO In

How To Ask Questions The Smart Way


Report •

#7
December 24, 2010 at 16:51:21
no this program is just for fun. between my friend and i :)

here's what i got


echo off
cls
:start
set INPUT=
set /P INPUT=Type input: %=%
echo Your input was: %INPUT%

pause
echo.| if %INPUT% == a echo .- >>temp.txt
echo.| if %INPut% == b echo -... >>temp.txt
echo.| if %INPUT% == c echo -.-. >>temp.txt
echo.| if %INPUT% == d echo -.. >>temp.txt
echo.| if %INPUT% == e echo . >>temp.txt
echo.| if %INPUT% == f echo ..-. >>temp.txt
echo.| if %INPUT% == g echo --. >>temp.txt
echo.| if %INPUT% == h echo .... >>temp.txt
echo.| if %INPUT% == i echo .. >>temp.txt
echo.| if %INPUT% == j echo .--- >>temp.txt
echo.| if %INPUT% == k echo -.- >>temp.txt
echo.| if %INPUT% == l echo .-.. >>temp.txt
echo.| if %INPUT% == m echo -- >>temp.txt
echo.| if %INPUT% == n echo -. >>temp.txt
echo.| if %INPUT% == o echo --- >>temp.txt
echo.| if %INPUT% == p echo .--. >>temp.txt
echo.| if %INPUT% == q echo --.- >>temp.txt
echo.| if %INPUT% == r echo .-. >>temp.txt
echo.| if %INPUT% == s echo ... >>temp.txt
echo.| if %INPUT% == t echo - >>temp.txt
echo.| if %INPUT% == u echo ..- >>temp.txt
echo.| if %INPUT% == v echo ...- >>temp.txt
echo.| if %INPUT% == w echo .-- >>temp.txt
echo.| if %INPUT% == x echo -..- >>temp.txt
echo.| if %INPUT% == y echo -.-- >>temp.txt
echo.| if %INPUT% == z echo --.. >>temp.txt
echo.| if %INPUT% == 1 echo .---- >>temp.txt
echo.| if %INPUT% == 2 echo ..--- >>temp.txt
echo.| if %INPUT% == 3 echo ...-- >>temp.txt
echo.| if %INPUT% == 4 echo ....- >>temp.txt
echo.| if %INPUT% == 5 echo ..... >>temp.txt
echo.| if %INPUT% == 6 echo -.... >>temp.txt
echo.| if %INPUT% == 7 echo --... >>temp.txt
echo.| if %INPUT% == 8 echo ---.. >>temp.txt
echo.| if %INPUT% == 9 echo ----. >>temp.txt
echo.| if %INPUT% == 0 echo ----- >>temp.txt
echo.| if %INPUT% == . echo .-.-. >>temp.txt
echo.| if %INPUT% == , echo --..-- >>temp.txt
echo.| if %INPUT% == ? echo ..--.. >>temp.txt
echo.| if %INPUT% == ap echo .----. >>temp.txt
echo.| if %INPUT% == ! echo -.-.-- >>temp.txt
echo.| if %INPUT% == bs echo -..-. >>temp.txt
echo.| if %INPUT% == - echo -....- >>temp.txt
echo.| if %INPUT% == fs echo -..-. >>temp.txt

echo.| if %INPUT% == ( echo -.--.- >>temp.txt
echo.| if %INPUT% == qt echo .-..-. >>temp.txt
echo.| if %INPUT% == exit goto :final


goto :start
:final
setlocal enabledelayedexpansion
set FINAL=
for /f %%a in (temp.txt) do (
set FINAL=!FINAL!%%a
)
echo %FINAL% >final.txt
pause
::del /q temp.txt
endlocal

exit

output file---------------------


Type input: test
Your input was: test
Press any key to continue . . .
The process tried to write to a nonexistent pipe.
The process tried to write to a nonexistent pipe.
The process tried to write to a nonexistent pipe.
The process tried to write to a nonexistent pipe.
Type input:


Report •

#8
December 24, 2010 at 16:52:34
Take a look at my reply here:

http://www.computing.net/answers/pr...


=====================================
Life is too important to be taken seriously.

M2


Report •

#9
December 24, 2010 at 21:49:27
the piping thing didn't work for some reason

echo off
cls

:start
set INPUT=
set /P INPUT=Type input: %=%
echo Your input was: %INPUT%

if %INPUT% == a echo 1eed >>temp.txt
if %INPut% == b echo 5dfs >>temp.txt
if %INPUT% == c echo f234 >>temp.txt
if %INPUT% == d echo 5gq3 >>temp.txt
if %INPUT% == e echo 324g >>temp.txt
if %INPUT% == f echo 432e >>temp.txt
if %INPUT% == g echo 341f >>temp.txt
if %INPUT% == h echo 3rea >>temp.txt
if %INPUT% == i echo 124r >>temp.txt
if %INPUT% == j echo 432q >>temp.txt
if %INPUT% == k echo 47ds >>temp.txt
if %INPUT% == l echo r32q >>temp.txt
if %INPUT% == m echo 432c >>temp.txt
if %INPUT% == n echo 489y >>temp.txt
if %INPUT% == o echo fd8s >>temp.txt
if %INPUT% == p echo 8gje >>temp.txt
if %INPUT% == q echo 8gje >>temp.txt
if %INPUT% == r echo 8gj4 >>temp.txt
if %INPUT% == s echo 92hf >>temp.txt
if %INPUT% == t echo hj8f >>temp.txt
if %INPUT% == u echo fhda >>temp.txt
if %INPUT% == v echo vhui >>temp.txt
if %INPUT% == w echo r8is >>temp.txt
if %INPUT% == x echo gy7f >>temp.txt
if %INPUT% == y echo er8f >>temp.txt
if %INPUT% == z echo 48gs >>temp.txt
if %INPUT% == 1 echo .---- >>temp.txt
if %INPUT% == 2 echo ..--- >>temp.txt
if %INPUT% == 3 echo ...-- >>temp.txt
if %INPUT% == 4 echo ....- >>temp.txt
if %INPUT% == 5 echo ..... >>temp.txt
if %INPUT% == 6 echo -.... >>temp.txt
if %INPUT% == 7 echo --... >>temp.txt
if %INPUT% == 8 echo ---.. >>temp.txt
if %INPUT% == 9 echo ----. >>temp.txt
if %INPUT% == 0 echo ----- >>temp.txt
if %INPUT% == . echo .-.-. >>temp.txt
if %INPUT% == , echo --..-- >>temp.txt
if %INPUT% == ? echo ..--.. >>temp.txt
if %INPUT% == ap echo .----. >>temp.txt
if %INPUT% == ! echo -.-.-- >>temp.txt
if %INPUT% == bs echo -..-. >>temp.txt
if %INPUT% == - echo -....- >>temp.txt
if %INPUT% == fs echo -..-. >>temp.txt

if %INPUT% == ( echo -.--.- >>temp.txt
if %INPUT% == qt echo .-..-. >>temp.txt
if %INPUT% == exit goto :final


goto :start
:final
setlocal enabledelayedexpansion
set FINAL=
for /f %%a in (temp.txt) do (
set FINAL=!FINAL!%%a
)
echo %FINAL% >.\final.html
pause
::del /q temp.txt
endlocal

exit



Report •

#10
December 24, 2010 at 23:17:36
echo.| if %INPUT% == a echo .- >>temp.txt

There is no space between echo.| and if %input%
echo.|if %INPUT% == a echo .- >>temp.txt


Report •

#11
December 29, 2010 at 07:14:09
it ended up like this. you can see the source code on the side. and i did try that

[IMG]http://i874.photobucket.com/albums/ab308/nfinch1992/ineedhelp.jpg[/IMG]

http://i874.photobucket.com/albums/...

thanks for the help


Report •

#12
December 29, 2010 at 07:17:26
and btw even if it's written like this
echo.|if %INPUT% == a echo .- >>temp.txt

it still says there is a pipe error


Report •

Ask Question