[solved] LAN chat /PM function

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
dwngrt
Posts: 26
Joined: 07 Oct 2013 05:14
Location: The Netherlands

[solved] LAN chat /PM function

#1 Post by dwngrt » 07 Nov 2013 06:26

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 :) .
Last edited by dwngrt on 07 Nov 2013 07:36, edited 1 time in total.

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: LAN chat /PM function

#2 Post by foxidrive » 07 Nov 2013 06:46

Maybe this is what you need:

Code: Select all

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

dwngrt
Posts: 26
Joined: 07 Oct 2013 05:14
Location: The Netherlands

Re: [solved] LAN chat /PM function

#3 Post by dwngrt » 07 Nov 2013 07:36

Thsnk you foxidrive, it did work :D you made my day ^^

Post Reply