![]() |
|
[Shell] Local Network/Homegroup Batch Chatroom - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [Shell] Local Network/Homegroup Batch Chatroom (/showthread.php?tid=4417341) |
Local Network/Homegroup Batch Chatroom - gogglebot - Aug 27, 2014 Hi there, After that post by IronByte asking about Chatrooms in Batch, and looking at a couple of the links posted in there I've decided to take one of them and modify it. I've left the original credit in there. It consists of two batch files currently, one is simple; "ChatDisplay.bat" does what it says on the tin, it displays the chat log, updating every second. Code @echo offThe main batch, (I named it ChatroomMain.bat, for whatever reason my brain came up with at the time, it doesn't particularly matter right now.) is the one that allows for a user to actually add messages to the chat log, clear the log, and exit. Code @echo offOn start up you can set your username, this will mark all your chats. It then outputs %username% has joined from %computername%. This helps to avoid confusion if someone starts up two of them with different names on the same PC, everyone can see that it's the same one. When you clear the log (by typing CLS or cls) it copies log.dat to "log-datehere-timehere.old" (in the format DDMMYYYY-HrsMins) and empties log.dat, leaving the message "%username% has cleared the chat log." Note: I need to add seconds to this to avoid overwrites in the case of a minute not passing between two clears. Any pointers? Typing either EXIT or exit will send the message "%username% has left the chat." The batch will stop you sending the same thing twice, in an anti-spam attempt. To use this with users on a network, you'd need to have a folder on one of the machines or on a server that is shared with all the users, with read\write permissions. You'll then need to set the logloc variable at the top to this folder, above I have left it blank. So it'd likely be \\HOST-NAME\chatroom\ IMPORTANT NOTE REGARDING THE LOCATION: THE TRAILING '\' IS IMPORTANT! DO NOT INCLUDE ""s AROUND IT, THE CODE DOES THIS ON ITS OWN, INCLUDING THEM YOURSELF WILL BREAK IT. Note: Avoid using the | pipe character as this has a tenancy to break stuff also. Note2: Remember if there's no log.dat ChatDisplay will not work until there is one, make sure logloc is correctly set in both files and that log.dat exists. Screenshots, using this and my old laptop connected on a homegroup network. Spoiler (Click to View) I hope someone somewhere finds this useful, Enjoy HF! Please report any issues (and a fix, if you can!) * - Xervo - Aug 29, 2014 Wow Really Nice work , Thanks for sharing......This Chat rooms are useful * - gogglebot - Aug 29, 2014 (Aug 29, 2014 08:46 AM)Xervo Wrote: Wow Really Nice work , Thanks for sharing......This Chat rooms are useful You're welcome :) Good to get some feed back! There's better options out there, this one's just very small and simple and needs no installation on other machines, which is nice, just stick em in a shared network folder and you're done! * - jeroendj2 - Aug 29, 2014 Im trying this out this Evening, if it actually works would be great like :D * - gogglebot - Aug 29, 2014 (Aug 29, 2014 09:39 AM)jeroendj2 Wrote: Im trying this out this Evening, if it actually works would be great like :D Cool, tell me if you have any issues! * - oRequiem - Aug 29, 2014 Thanks for the share, pretty nifty. * - b00st3d - Aug 29, 2014 good work with this it really got my creative gears working for the last couple days. I have included it in my HTA that I use at work I'll be releasing the HTA here in a little bit after I finish sanitizing it with you credited for this. I made some changes to it so it now posts to a dynamic HTML document rather than another batch. * - Niely - Aug 29, 2014 Nice one bro! :) Really originally and not seen before! * - gogglebot - Aug 29, 2014 (Aug 29, 2014 11:03 AM)b00st3d Wrote: good work with this it really got my creative gears working for the last couple days. I have included it in my HTA that I use at work I'll be releasing the HTA here in a little bit after I finish sanitizing it with you credited for this. I made some changes to it so it now posts to a dynamic HTML document rather than another batch. Awesome man glad I could help :D (Also awesome something I've made is getting used in "the wild" 😁 ✌ ) I'd like to see the changes! Viewing in a browser would be awesome! EDIT: Just read the name of it in your HTA thing, batCHAT. Awesome. :D * - jeroendj2 - Aug 30, 2014 Hey bro, i tested it out on my pc and it works, kinda funny :) But i got one thing, how can I like chat to someone on the same network? As the log.dat is saved on 1 pc * - gogglebot - Aug 30, 2014 (Aug 30, 2014 12:48 AM)jeroendj2 Wrote: Hey bro, i tested it out on my pc and it works, kinda funny :) I guess both of the computers you want to talk between are connected to the same router? Is this at home? If its at home and you have a newer Windows version then it should have homegroups on it, google a tutorial if you're unsure on how to set up a homegroup and share folders between two computers on it. Once you've got both computers connected to the homegroup, you'll need to make the folder that has the bat files and log in it shared with your homegroup and make sure that homegroup has read AND write permissions to that folder, so they can add messages to the log and read the files and the log back. Remember to set the logloc variable to point to \\HOST-MACHINE\foldershere\chatroom\ (substituting the computer name and the directories) This way when other users run it it points to that folder on the host computer rather than trying to find the non-existant folder C:\folders\chatroom\ on themselves, it does come up with an error at first when you run it from another machine saying it doesn't support UDC or something like that, this I do here is a work around, so you can ignore that error, I was trying to find a way to hide it. To make it easier I myself put it on this laptop straight onto C:\chatroom\ so all I had to type in logloc was \\LAPTOP-NAME\Chatroom\ and that was it, share the Chatroom folder with homegroup and join it from my other laptop and I could talk between them :) IF on the otherhand you're doing this on a network that isn't at home, Are you the/one of the admin(s)? If no, don't do it! ask about it first :p If you are it's a similar process, you just need a folder that's on the network that's shared with all the users on that network, rather than sharing with homegroup, if it's got public computers then you might want to find a way to only share write ability to log.dat and file creation in the folder, etc. As someone could tamper with the batch files. Of course if it's all trusted people then you don't need to bother. I guess you have some understanding of batch, so if you wanted it to show the username of the person logged on the computer rather than letting them set their own username, just remove the bit where they set it and it'll default %username% to whoever's logged on's pc username. In a workplace I imagine you'd do this. * - jeroendj2 - Aug 30, 2014 oh yea thanks for the information! loveu * - gogglebot - Aug 30, 2014 Hello, thought I'd make something for this, it's a sort of announcement maker, it's (yet another) batch file that loops through various announcements that an Admin could set and posts them to the chat, occasionally clearing the chatlog to avoid flooding it (when it gets big ChatDisplay starts to have a significant lag-flash before it shows everything again. ) An admin could just have this running in the background, it requires no attention aside from setting the announcements. Code @echo offAlso: I found an issue. Near the bottom of chatroommain.bat I accidentally put a '/' between %logloc% and log.dat. I believe this will cause issues. Please locate and remove this slash from your local versions, if it's there. Also there's an issue with writing the hour into the .old logs, I'm unsure why this is occurring, so am unable to fix it at this time, if you have a fix, please tell me! * - nuk - Aug 31, 2014 Dayum man... this is where it's at :) Great job on this... I'm gonna see what I can add to it, etc... Thanks for this :) * - gogglebot - Aug 31, 2014 (Aug 31, 2014 01:17 AM)nuk Wrote: Dayum man... this is where it's at :) Great job on this... I'm gonna see what I can add to it, etc... Thanks for this :) Glad you like it :) Share what you add I'd love to expand this. |