LAN Chat program 2
Hey friends,
I am back with a new LAN Chat program!! This time a better one and an integrated one!!!
This is just almost perfect Chat program anybody could wish for for LANS.
This program is made up of batch files so will work on any PC! I am not sure about Windows 8 and above! If its not working on Windows 8 and above then do tell me!
DO NOTE- DO KEEP ALL THE NAMES AS MENTIONED BEFORE THE CODE BEGINS
While saving all the files save them as .bat files.
The framework file-
Chat
@echo off
SETLOCAL EnableDelayedExpansion
for /F "tokens=1,2 delims=#" %%a in ('"prompt #$H#$E# & echo on & for %%b in (1) do rem"') do (
set "DEL=%%a"
)
:StartUp
set rr=2
mode con cols=40 lines=8
if exist tmp.bat del /f /s /q tmp.bat
set hd=%cd%
title Chat
color 0f
cls
echo [Chat]
echo.
echo Made by DEADLY ASSASIN
echo athravassolutions.blogspot.in
set t1=%time:~6,2%
set /a t2=%t1%+2
if %t2% geq 60 set /a t2=%t2% - 59
:ExpLoop
if %time:~6,2% geq %t2% goto Go
goto ExpLoop
:Go
set cs=ChatSettings.bat
if exist %cs% (
call %cs%
goto Main
) else (
goto SetUp
)
:SetUp
cls
echo [Setup]
echo.
set /p un=Username:
cmd /c > %un%.txt
if not defined un goto SetUp
:SetUp2
cls
echo [Setup]
echo.
echo Use this format:
echo D:\Chat folder
if defined sd echo Current: %sd%
echo.
set /p sd=Server folder:
if not defined sd goto SetUp2
set sd=%sd%
if not exist %sd% (
set sd=
echo Folder doesn't exist!
pause >nul
goto SetUp2
)
if exist %cs% del /f /s /q %cs%
echo set un=%un%>>%cs%
echo set sd=%sd%>>%cs%
echo set rr=4>>%cs%
goto Main
:Main
cd %hd%
cls
echo [Chat]
echo.
echo 1 - Join
echo 2 - Create
echo 3 - Settings
echo 4 - Exit
echo.
set /p c=
if %c%==1 goto Join
if %c%==2 goto Create
if %c%==3 goto SetUp
if %c%==4 goto Exit
goto main
:Exit
exit
:Create
cd %sd%
set rn=
cls
echo [Create]
echo.
echo Don't use spaces!
echo.
set /p rn=Room's name:
if not defined rn goto Create
set rf=%sd%\%rn%.crm
if exist %rf% goto Create
cls
echo [Create]
echo.
echo Preparing room, please wait.
set group=Admin
echo [%time:~0,5%] %un% (admin) connected.>>%rf%
title Chat [%rn%]
cd %hd%
echo set rn=%rn%>>tmp.bat
echo set rf=%rf%>>tmp.bat
echo set group=%group%>>tmp.bat
start ChatMessage.bat
start ChatDisconnect.bat
cd %sd%
mode con cols=40 lines=16
:Admin
cls
cd %hd% >nul
if not exist tmp.bat (
set msg=Room closed successfully.
goto End
)
cd %sd% >nul
if not exist %rf% (
set msg=Connection terminated.
goto End
)
type %rf%
ping localhost -n 4 >nul
goto Admin
set t=%time:~7,1%+%rr%
if %t% GEQ 10 set /a t=%t% - 10
:AdminL
if %time:~7,1%==%t% goto Admin
:End
if exist tmp.bat del /f /s /q tmp.bat
mode con cols=40 lines=8
echo [Chat]
echo.
echo %msg%
set msg=
taskkill /f /fi "WINDOWTITLE eq Message" >nul
taskkill /f /fi "WINDOWTITLE eq Disconnect" >nul
title Chat
set group=
set rn=
set t1=%time:~6,2%
set /a t2=%t1%+2
if %t2% geq 60 set /a t2=%t2% - 5
:EndLoop
if %time:~6,2% geq %t2% goto Main
goto EndLoop
:Join
mode con cols=40 lines=16
cd %sd%
set rn=
cls
echo [Join]
echo.
if not exist %sd%\*crm (
echo No rooms available.
pause >nul
mode con cols=40 lines=8
goto Main
)
dir /b /o:n %sd%\*.crm
echo.
echo Format (no .crm at end): Room
set /p rn=Room's name:
if not defined rn goto Join
set rf=%sd%\%rn%.crm
if not exist %rf% goto Join
cls
echo [Join]
echo.
echo Joining room, please wait.
set group=User
echo [%time:~0,5%] %un% connected.>>%rf%
title Chat [%rn%]
cd %hd%
echo set rn=%rn%>>tmp.bat
echo set rf=%rf%>>tmp.bat
echo set group=%group%>>tmp.bat
start ChatMessage.bat
start ChatDisconnect.bat
cd %sd%
:User
cls
cd %hd% >nul
if not exist tmp.bat (
set msg=YOU ARE KICKED
echo [%time:~0,5%] %un% is kicked.>>%rf%
goto End
)
cd %sd% >nul
if not exist %rf% (
set msg=Connection terminated.
goto End
)
type %rf%
ping localhost -n 4 >nul
goto User
:ColorText
echo off
<nul set /p ".=%DEL%" > "%~2"
findstr /v /a:%1 /R "^$" "%~2" nul
del "%~2" > nul 2>&1
Now the Message box
ChatMessage
@echo off
if not exist tmp.bat (
exit
) else (
call tmp.bat
call ChatSettings.bat
)
title Message
mode con cols=30 lines=2
cd %sd%
:func
cls
set /p msg=Message:
if %msg:~0,3%==/me echo [%time:~0,5%] %un% %msg:~4%>>%rf%
if not defined msg goto func
echo [%time:~0,5%] %un%: %msg%>>%rf%
goto func
Finally the Disconnect box
ChatDisconnect
@echo off
if not exist tmp.bat (
exit
) else (
call tmp.bat
call ChatSettings.bat
)
title Disconnect
mode con cols=30 lines=2
cls
if %group%==Admin echo Press any key to close room.
if %group%==User echo Press any key to leave room.
pause >nul
taskkill /fi "WINDOWTITLE eq Chat [%rn%]" >nul
taskkill /fi "WINDOWTITLE eq Message " >nul
del tmp.bat
echo [%time:~0,5%] %un% left.>>%rf%
start Chat
exit
Thats all folks!! If you do come across any doubts or errors while running the chat program do comment!!
Thanks for reading!
I am back with a new LAN Chat program!! This time a better one and an integrated one!!!
This is just almost perfect Chat program anybody could wish for for LANS.
This program is made up of batch files so will work on any PC! I am not sure about Windows 8 and above! If its not working on Windows 8 and above then do tell me!
DO NOTE- DO KEEP ALL THE NAMES AS MENTIONED BEFORE THE CODE BEGINS
While saving all the files save them as .bat files.
The framework file-
Chat
@echo off
SETLOCAL EnableDelayedExpansion
for /F "tokens=1,2 delims=#" %%a in ('"prompt #$H#$E# & echo on & for %%b in (1) do rem"') do (
set "DEL=%%a"
)
:StartUp
set rr=2
mode con cols=40 lines=8
if exist tmp.bat del /f /s /q tmp.bat
set hd=%cd%
title Chat
color 0f
cls
echo [Chat]
echo.
echo Made by DEADLY ASSASIN
echo athravassolutions.blogspot.in
set t1=%time:~6,2%
set /a t2=%t1%+2
if %t2% geq 60 set /a t2=%t2% - 59
:ExpLoop
if %time:~6,2% geq %t2% goto Go
goto ExpLoop
:Go
set cs=ChatSettings.bat
if exist %cs% (
call %cs%
goto Main
) else (
goto SetUp
)
:SetUp
cls
echo [Setup]
echo.
set /p un=Username:
cmd /c > %un%.txt
if not defined un goto SetUp
:SetUp2
cls
echo [Setup]
echo.
echo Use this format:
echo D:\Chat folder
if defined sd echo Current: %sd%
echo.
set /p sd=Server folder:
if not defined sd goto SetUp2
set sd=%sd%
if not exist %sd% (
set sd=
echo Folder doesn't exist!
pause >nul
goto SetUp2
)
if exist %cs% del /f /s /q %cs%
echo set un=%un%>>%cs%
echo set sd=%sd%>>%cs%
echo set rr=4>>%cs%
goto Main
:Main
cd %hd%
cls
echo [Chat]
echo.
echo 1 - Join
echo 2 - Create
echo 3 - Settings
echo 4 - Exit
echo.
set /p c=
if %c%==1 goto Join
if %c%==2 goto Create
if %c%==3 goto SetUp
if %c%==4 goto Exit
goto main
:Exit
exit
:Create
cd %sd%
set rn=
cls
echo [Create]
echo.
echo Don't use spaces!
echo.
set /p rn=Room's name:
if not defined rn goto Create
set rf=%sd%\%rn%.crm
if exist %rf% goto Create
cls
echo [Create]
echo.
echo Preparing room, please wait.
set group=Admin
echo [%time:~0,5%] %un% (admin) connected.>>%rf%
title Chat [%rn%]
cd %hd%
echo set rn=%rn%>>tmp.bat
echo set rf=%rf%>>tmp.bat
echo set group=%group%>>tmp.bat
start ChatMessage.bat
start ChatDisconnect.bat
cd %sd%
mode con cols=40 lines=16
:Admin
cls
cd %hd% >nul
if not exist tmp.bat (
set msg=Room closed successfully.
goto End
)
cd %sd% >nul
if not exist %rf% (
set msg=Connection terminated.
goto End
)
type %rf%
ping localhost -n 4 >nul
goto Admin
set t=%time:~7,1%+%rr%
if %t% GEQ 10 set /a t=%t% - 10
:AdminL
if %time:~7,1%==%t% goto Admin
:End
if exist tmp.bat del /f /s /q tmp.bat
mode con cols=40 lines=8
echo [Chat]
echo.
echo %msg%
set msg=
taskkill /f /fi "WINDOWTITLE eq Message" >nul
taskkill /f /fi "WINDOWTITLE eq Disconnect" >nul
title Chat
set group=
set rn=
set t1=%time:~6,2%
set /a t2=%t1%+2
if %t2% geq 60 set /a t2=%t2% - 5
:EndLoop
if %time:~6,2% geq %t2% goto Main
goto EndLoop
:Join
mode con cols=40 lines=16
cd %sd%
set rn=
cls
echo [Join]
echo.
if not exist %sd%\*crm (
echo No rooms available.
pause >nul
mode con cols=40 lines=8
goto Main
)
dir /b /o:n %sd%\*.crm
echo.
echo Format (no .crm at end): Room
set /p rn=Room's name:
if not defined rn goto Join
set rf=%sd%\%rn%.crm
if not exist %rf% goto Join
cls
echo [Join]
echo.
echo Joining room, please wait.
set group=User
echo [%time:~0,5%] %un% connected.>>%rf%
title Chat [%rn%]
cd %hd%
echo set rn=%rn%>>tmp.bat
echo set rf=%rf%>>tmp.bat
echo set group=%group%>>tmp.bat
start ChatMessage.bat
start ChatDisconnect.bat
cd %sd%
:User
cls
cd %hd% >nul
if not exist tmp.bat (
set msg=YOU ARE KICKED
echo [%time:~0,5%] %un% is kicked.>>%rf%
goto End
)
cd %sd% >nul
if not exist %rf% (
set msg=Connection terminated.
goto End
)
type %rf%
ping localhost -n 4 >nul
goto User
:ColorText
echo off
<nul set /p ".=%DEL%" > "%~2"
findstr /v /a:%1 /R "^$" "%~2" nul
del "%~2" > nul 2>&1
Now the Message box
ChatMessage
@echo off
if not exist tmp.bat (
exit
) else (
call tmp.bat
call ChatSettings.bat
)
title Message
mode con cols=30 lines=2
cd %sd%
:func
cls
set /p msg=Message:
if %msg:~0,3%==/me echo [%time:~0,5%] %un% %msg:~4%>>%rf%
if not defined msg goto func
echo [%time:~0,5%] %un%: %msg%>>%rf%
goto func
Finally the Disconnect box
ChatDisconnect
@echo off
if not exist tmp.bat (
exit
) else (
call tmp.bat
call ChatSettings.bat
)
title Disconnect
mode con cols=30 lines=2
cls
if %group%==Admin echo Press any key to close room.
if %group%==User echo Press any key to leave room.
pause >nul
taskkill /fi "WINDOWTITLE eq Chat [%rn%]" >nul
taskkill /fi "WINDOWTITLE eq Message " >nul
del tmp.bat
echo [%time:~0,5%] %un% left.>>%rf%
start Chat
exit
Thats all folks!! If you do come across any doubts or errors while running the chat program do comment!!
Thanks for reading!
Comments
Post a Comment