okay i have a chat room code, it currently saves all info in a file called chat.dat and then displays it on the screen, however the script requirs all users have access to the shared folder where the executable lays, i was wondering if there was a way to make it so other computers could put in an ip address via inputbox, that would send the data to the chat.dat file, so they dont have to have access. also it is currently set to read the tex down like a ttraditional chat room and clears it when its at the bottom of the screen, is there a way to make it so that the text can continuously go down and be updated wthout the text box being set back up to the top every second (and i would like messaging over ip to work for private messaging to)
perhaps an easyer way would be ftp? if so then can someone tell me where to get an ftp code, and what codes to use and where to put then, so that maybe it would work the same way, it would download then read the old chat log then create a new one containing the new message then delete the old on in ftp, then upload the new one and download it to all scripts and display it?
just some ideas bu ti would really lik eto find a fast efficeint way to do this, and also also it is currently set to read the tex down like a ttraditional chat room and clears it when its at the bottom of the screen, is there a way to make it so that the text can continuously go down and be updated wthout the text box being set back up to the top every second is important in case a lot of ppl r talking so the text wont be lost.
any help is appriciated
Code:
#IfWinActive, Lan Chat v1.0.4 - emoyasha dev co
#NoEnv
SendMode Input
SetWorkingDir %A_ScriptDir%
mcounter = 0
hcounter = 0
; Set up the tray menu
Menu,Tray,NoStandard
Menu,Tray,DeleteAll
Menu,Tray,Add,Chat
Menu,Tray,Add,ChangeUsername
Menu,Tray,Add,ChangeMessage
Menu,Tray,Add,Hotkeys
Menu,Tray,Add,About
Menu,Tray,Add,Exit
Menu,Tray,Default,Chat
Menu,Tray,add,admin
Menu,Tray,add,logviewer
; Check if the setting file exists
Ifnotexist, %a_windir%\system32\lcsettings.dll
{
Msgbox, , Lan Talk v1.0.4, Written By: EmoYasha`n`nIdea By: Tim Chen
InputBox, name, Lan Chat v1.0.4, What do you want your chat name to be?
if ErrorLevel ; Just in case they cancel
{
MsgBox, You cancelled.
ExitApp
}
IniWrite, %name%, %a_windir%\system32\lcsettings.dll, Personal, name
Loop
{
Random, yourcomp, 100, 999 ; Generate a computer number
Loop, read, users.ini
{
if a_loopreadline contains %yourcomp%
{
used = 1
break
}
}
if used <> 1
break
}
IniWrite, %yourcomp%, %a_windir%\system32\lcsettings.dll, Computer, id
IniWrite, %name%, users.ini, %yourcomp%, name
IniWrite, 0, %a_windir%\system32\lcsettings.dll, Personal, Message ; Set the predefined message to nothing
}
Else ; It already exists so read it
{
IniRead, name, %a_windir%\system32\lcsettings.dll, Personal, name
IniRead, yourcomp, %a_windir%\system32\lcsettings.dll, Computer, id
Iniread, bl, %a_windir%\system32\lcsettings.dll, Computer, bl ; Check to see if the user is blocked
if bl = 1 ; If it is
{
IniRead, ul, users.ini, %yourcomp%, bl ; Read the user file to see if they were unblocked
if ul = 2 ; If they were
{
IniDelete, %a_windir%\system32\lcsettings.dll, Computer, bl ; Unblock the settings file on the computer
IniDelete, users.ini, %yourcomp%, bl ; Clean up the users.ini file
}
else ; If they are still blocked
{
Msgbox,, Blocked, What do you think your doing!!! You've been blocked!,2
ExitApp
}
}
IniWrite, %name%, users.ini, %yourcomp%, name ; Update their username and comp id on the users.ini file
}
IniWrite, *, users.ini, %yourcomp%, online
Settimer, updatechat, 1000 ; Update the chat window every second
Settimer, Checkbl, 5000 ; Check to see if you've been blocked every five second
Settimer, CheckMessages, 1000 ; Check for Messages every 2 seconds
Settimer, UpdateUserList, 1000 ; Update the user list
; Set up the admin window
Gui, 2:Add, Button, x6 y70 w130 h20 , Update Done
Gui, 2:Add, Button, x6 y10 w130 h20 , Turn Cleaner ON
Gui, 2:Add, Button, x6 y30 w130 h20 , Print Todays Logs
Gui, 2:Add, Button, x6 y50 w130 h20 , Update Program
Gui, 2:Add, Edit, x16 y120 w50 h20 vcomid, ID
Gui, 2:Add, Button, x76 y120 w50 h20 , Block
Gui, 2:Add, Button, x26 y150 w90 h20 , Un Block
Gui, 2:Add, GroupBox, x6 y100 w130 h80 , User Control
; Set up the gui window
; Chat Box
Gui, Add, Edit, x16 y350 w260 h20 vMessage, Type your message here...
Gui, Add, Edit, x306 y340 w80 h20 vtocomp, CompID
Gui, Add, Button, x696 y340 w60 h20 , Send
Gui, Add, Button, x626 y270 w50 h20 , Action
Gui, Add, GroupBox, x6 y0 w480 h400 +, Chat
Gui, Add, Edit, x16 y20 w260 h330 vChatWindow +ReadOnly, Looks like no one has posted a message yet...
Gui, Add, Text, x16 y370 w200 h20 +, Press Enter to send the message
Gui, Add, button, x190 y370 default genter1 + , send
Gui, Add, GroupBox, x296 y300 w180 h70 , Send Private Message
Gui, Add, Text, x316 y320 w140 h20 , Send a message to one user
Gui, Add, Button, x236 y410 w50 h50 , Open`nSidebar
Gui, Add, GroupBox, x6 y400 w220 h70 , Private Messages
Gui, Add, Edit, x16 y420 w200 h40 vMessageWindow +ReadOnly, Your messages will come in here...
Gui, Add, GroupBox, x296 y0 w180 h300 , User List
Gui, Add, Edit, x306 y20 w160 h270 vUserWindow +ReadOnly, Users in Chat
Gui, Show, x50 y50 h483 w295, Lan Chat v1.0.4 - emoyasha dev co
Return
;---------------Tray Items
Chat:
WinActivate, Lan Chat v1.0.4 ; Brings the window to the front
return
ChangeUsername:
stop = 0
InputBox, newname, Lan Chat v1.0.4, What do you want you chat name to be?
FileRead, tempusers, users.ini
if tempusers contains %newname%
{
Msgbox, Sorry but this username has already been taken.
return
}
oldname = %name%
name = %newname%
IniWrite, %name%, %a_windir%\system32\lcsettings.dll, Personal, name ; Save the changes to the setting file
IniWrite, %name%, users.ini, %yourcomp%, name ; Update the users.ini file
FileAppend, "%oldname%" changed his name to "%name%" %a_yday%`n, userhistory.dat ; And make a new one
return
ChangeMessage:
InputBox, buttonmess, Lan Chat v1.0.4, What do you want to change the predefined message to?
if ErrorLevel
return
IniWrite, %buttonmess%, %a_windir%\system32\lcsettings.dll, Personal, Message ; Save the predefined message to the settings files
goto buttonl ; Press the button to send the chat message
return
^h:: ; Control Shift h
Hotkeys: ; Hotkey help
Msgbox, , Lan Chat Hotkeys, Control+h - Hotkeys Help`nControl+m - Open Messages`nControl+e - Hides the Window`nControl+Alt+a - Action`nControl+Shift+a - Admin Menu`nControl+Alt+s - Send private message`nControl+p - Send your predefined message`n`nAlt+x - Exits
return
About:
Msgbox, , Lan Talk v1.0.4, Written By: EmoYasha`n`nIdea By: Tim Chen
return
!x:: ; Alt x to exit
GuiClose: ; When you close the window it exits the app
Exit: ; Tray option to exit
IniWrite, -, users.ini, %yourcomp%, online
FileDelete, cleaner.dll
Ifexist, %yourcomp%mess.dat
FileDelete, %yourcomp%mess.dat
ExitApp
return
;---------------The end of the tray menu
;---------------Buttons and hotkeys for the Gui
^m:: ; Hotkey for message dropdown box
ButtonOpenSidebar: ; Where the button in the gui starts
If mcounter = 0 ; If it isn't dropped down
{
Gui, Show, x50 y50 h483 w489, Lan Chat v1.0.4 - emoyasha dev co ; Drops the box down (changes the width to 489)
GuiControl,, Open`nSidebar, Close`nSidebar ; Changes the button text to "Close"
WinActivate, Lan Chat v1.0.4 ; Makes sure the window is on top
mcounter ++ ; Sets the counter to 1
}
else ; If it is dropped down
{
Gui, Show, x50 y50 h483 w295, Lan Chat v1.0.4 - emoyasha dev co ; Hides the dropdown box (changes the height to 370)
GuiControl,, Close`nSidebar, Open`nSidebar ; Changes the button text to "Open"
WinActivate, Lan Chat v1.0.4 ; Makes sure the window is on top
mcounter = 0 ; Sets teh counter back to 0
}
return
^Enter::
Enter::
enter1:
Gui, Submit, nohide ; Submit what they wrote
GuiControl,, Message ; Clear the chat log
FileRead, chat, chat.dat ; Read the old log
FileDelete, chat.dat ; Delete it
FileAppend, %chat%`n :%name%: %message%, chat.dat ; And make a new one
GuiControl,, ChatWindow, %chat%
return
^!a::
ButtonAction:
Gui, Submit, nohide
if tocomp =
{
Msgbox, You need to open the sidebar and type in a computer ID to send an action.
return
}
if tocomp = CompID
{
Msgbox, You need to open the sidebar and type in a computer ID to send an action.
return
}
IniRead, compidname, users.ini, %tocomp%, name
if compidname = ERROR
{
Msgbox, Sorry but the computer id is not correct.
return
}
GuiControl, ,Message
FileRead, chat, chat.dat ; Read the old log
FileDelete, chat.dat ; Delete it
FileAppend, **%name% %message% %compidname%`n%chat%, chat.dat ; And make a new one
return
^p::
Buttonl: ; Predefined Message
IniRead, buttonmess, %a_windir%\system32\lcsettings.dll, Personal, Message ; See if a predefined message already exists
if buttonmess <> 0 ; If it does exist
{
GuiControl,, Message ; Clear the chat log
FileRead, chat, chat.dat ; Read the old log
FileDelete, chat.dat ; Delete it
FileAppend, :%name%: %buttonmess%`n%chat%, chat.dat ; And make a new one
GuiControl,, ChatWindow, %chat%
}
else ; If it doesn't
goto changemessage ; Go to the sub to make a new one
return
^!s::
ButtonSend: ; Direct Message Button
Gui, Submit, nohide
IniRead, compidname, users.ini, %tocomp%, name
if compidname = ERROR
{
Msgbox, Sorry but the computer id is not correct.
return
}
GuiControl,, Message
FileAppend, -From %name%: %message%`n, %tocomp%.dat
TrayTip, Lan Chat, Your message has been sent. ; Show a traytip message
Sleep, 3000 ; Wait 3 seconds
Traytip ; Remove the traytip
return
^e:: ; Hides the window
If hcounter = 0 ; If the window is not hidden
{
Gui, Hide ; Hide it
hcounter ++ ; Set the counter to 1
}
else ; If the window is hidden
{
Gui, Show, x50 y50 h483 w295, Lan Chat v1.0.4 - emoyasha dev co ; Show it
WinActivate, Lan Chat ; Make sure it is on top
hcounter = 0 ; Set the counter back to zero
}
return
;---------------End of the gui buttons and hotkeys
;---------------Timers
UpdateUserList:
FileDelete, %a_temp%\ultemp.dat
Loop, read, users.ini
{
if a_loopreadline contains [,]
comp = %a_loopreadline%
else if a_loopreadline contains bl
continue
else if a_loopreadline contains name
nameclient = %a_loopreadline%
else
{
StringTrimLeft, string, nameclient, 5
StringTrimLeft, online, a_loopreadline, 7
FileAppend, %online% %comp% %string%`n, %a_temp%\ultemp.dat
}
}
Fileread, userlist, %a_temp%\ultemp.dat
GuiControl,, UserWindow, %userlist%
return
UpdateChat: ; Update the chat window
Ifexist, chat.dat
{
FileRead, chat, chat.dat ; Read the chat log
GuiControl,, ChatWindow, %chat% ; Put it into the window
}
return
CheckMessages:
ifexist, %yourcomp%.dat ; Check to see if you got any private messages
{
FileRead, dirmess, %yourcomp%.dat ; Read the messages for just your computer
Filedelete, %yourcomp%.dat ; Delete them
FileRead, compmess, %yourcomp%mess.dat ; Read the old messages
FileDelete, %yourcomp%mess.dat ; Delete them
FileAppend, %dirmess%%compmess%, %yourcomp%mess.dat ; Put them together
FileRead, messages, %yourcomp%mess.dat ; Read it to a variable
GuiControl,, MessageWindow, %messages% ; Send the variable to the window
TrayTip, Lan Chat Message, You have a new message. ; Show a traytip message
Sleep, 3000 ; Wait 3 seconds
Traytip ; Remove the traytip
}
return
CheckBl: ; Check to see if the person is blocked
IniRead, bl, users.ini, %yourcomp%, bl ; Read the ini file
if bl = 1 ; If they are blocked
{
IniDelete, users.ini, %yourcomp%, bl ; Clean up the users.ini file
IniWrite, 1, %a_windir%\system32\lcsettings.dll, Computer, bl ; Write that the person is blocked to their computer so they can't change it
Gui, hide ; Hide the gui until the message box closes
Msgbox,, Blocked, You've been blocked...Jerk!,2
goto exit
}
return
;---------------End of Timers
;---------------Admin Suff
admin:
^+a::
Inputbox, pass, Lan Chat Admin, Enter the password., hide
if ErrorLevel
return
if pass not contains passwordhere;
return
Gui, 2:Show, x600 y50 h193 w150, Admin Area
Return
^z::
Gui, 2:Hide
return
2ButtonTurnCleanerON:
Ifnotexist, cleaner.dll
{
Settimer, cleaner, 60000
Ifnotexist, log\
Filecreatedir, log
FileAppend, %yourcomp%, cleaner.dll
TrayTip, Lan Chat, The Cleaner is running...
Sleep, 3000
Traytip
cleaning = 1
}
else
{
FileRead, cleanerfile, cleaner.dll
IniRead, cleanercomp, users.ini, %cleanerfile%, name
Msgbox, Sorry but the cleaner is being used by %cleanercomp%.
}
return
Cleaner:
Ifexist chat.dat
{
FileGetSize, chatsize, chat.dat, b
if chatsize > 800
{
FileRead, chatt, chat.dat
FileDelete, chat.dat
FileAppend, SYSTEM: The chat has been cleared., chat.dat
FileAppend, %chatt%`n, log\%A_YDay%.dat
}
}
return
; Manually clean
^+c::
if cleaning = 1
{
FileRead, chatt, chat.dat
FileDelete, chat.dat
FileAppend, SYSTEM: The chat has been cleared., chat.dat
FileAppend, %chatt%`n, log\%A_YDay%.dat
}
return
2ButtonPrintTodaysLogs:
FileDelete, %a_temp%\chat.txt
ifexist log\%A_YDay%.dat
{
Loop, read, log\%A_YDay%.dat ; Do a filereadloop to make sure it looks good
{
if substr(a_loopreadline,1,6) <> SYSTEM
FileAppend, %a_loopreadline%`n, %a_temp%\chat.txt
}
Run, print %a_temp%\chat.txt ; Print the output
}
else
Msgbox, Sorry but the cleaner needs to be running and have made a backup for the log.
return
2ButtonUpdateProgram:
FileCopy, users.ini, %a_temp%\users.ini,1
Loop, read, %a_temp%\users.ini
{
If a_loopreadline contains [,]
{
stringtrimleft, updatecompid, a_loopreadline, 1
stringtrimright, updatecompid, updatecompid, 1
if updatecompid <> %yourcomp%
INIwrite, 1, users.ini, %updatecompid%, bl
}
}
return
2ButtonUpdateDone:
FileCopy, users.ini, %a_temp%\users.ini,1
Loop, read, %a_temp%\users.ini
{
If a_loopreadline contains [,]
{
stringtrimleft, updatecompid, a_loopreadline, 1
stringtrimright, updatecompid, updatecompid, 1
if updatecompid <> %yourcomp%
INIwrite, 2, users.ini, %updatecompid%, bl
}
}
return
2ButtonBlock:
Gui, 2:Submit, NoHide
if comid =
return
if comid = ID
return
IniWrite, 1, users.ini, %comid%, bl
IniRead, blockedname, users.ini, %comid%, name
FileRead, chat, chat.dat ; Read the old log
FileDelete, chat.dat ; Delete it
FileAppend, %blockedname% has been kicked`n%chat%, chat.dat ; And make a new one
return
2ButtonUnBlock:
Gui, 2:Submit, NoHide
if comid =
return
if comid = ID
return
IniWrite, 2, users.ini, %comid%, bl
return
^+x:: ; Delete the user settings and close
FileDelete, %a_windir%\system32\lcsettings.dll
ExitApp
return
logviewer:
Inputbox, pass, log viewer, Enter the password to view the chat logs, hide
if ErrorLevel
return
if pass not contains logadminpass
return
run, "log/log viewer.exe"