Page 1 of 1

[solved] LAN chat /PM function

Posted: 07 Nov 2013 06:26
by dwngrt
Hello dear people,

So since a while we (IT students) are using this batch chat for LAN communication trough the building.
The source is pretty big so i whon't post that on here, but i am working on a /PM function.

Here is the idea i got:

Code: Select all

set C=
set /p C=[msg]:

if "%C%"=="/pm" goto pm


here the PM menu:

Code: Select all

:pm
cls
echo please don't use this function to troll, it can be anoying for other users...
echo.
echo what is the msg you want to send?
set P=
set /p P=[msg]:
cls
cls
echo please don't use this function to troll, it can be anoying for other users...
echo.
echo Who you want to send it to?
type users.txt
echo.
set M=
set /p M=[User]:
echo %P%>pm\%M%\pm.txt
goto chat


The pm will be shown using the reader script which also shows the chat.txt file, here the reader PM function:

Code: Select all

if exist pm\%username%\pm.txt goto pm


Code: Select all

:pm
cls
(
set pm=
)<pm\%username%\pm.txt
msg * %pm%
del pm\%username%\pm.txt
goto read


so the /pm sort of works, the thing that doesn't work is when the pm.txt is detected by the reader it will show the user there was a PM send, then it asks the user to fill in the msg for himself in the console window:

Enter message to send, close the message by a new line
CTRL + Z, and then press ENTER


after doing this the msg * window will pop up with the msg containing what the user just wrote, this is not what we are trying to achieve X3

If there is more code from the source needed please leave a msg, i can also post the whole source codes on pastebin if needed :) .

Re: LAN chat /PM function

Posted: 07 Nov 2013 06:46
by foxidrive
Maybe this is what you need:

Code: Select all

set /p "pm=" < "pm\%username%\pm.txt"

Re: [solved] LAN chat /PM function

Posted: 07 Nov 2013 07:36
by dwngrt
Thsnk you foxidrive, it did work :D you made my day ^^