AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Lan Chat
Goto page 1, 2  Next
 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
nickromano



Joined: 28 Nov 2007
Posts: 25
Location: USA

PostPosted: Thu Dec 13, 2007 2:31 am    Post subject: Lan Chat Reply with quote

I am in this class that has computers that are only conected by LAN and not the internet so all of us in the class needed a way to chat. So i made this script that everyone can run from a shared folder that saves settings in their my documents folder and it also has a list of the people in the chat in users.ini. Please tell me what you think.

Code:
Menu,Tray,NoStandard
Menu,Tray,DeleteAll
Menu,Tray,Add,About
Menu,Tray,Add,ChangeUsername
Menu,Tray,Add,Exit
Menu,Tray,Default,About

Ifnotexist, %a_mydocuments%\usersettings.ini
{
  InputBox, name, Lan Chat v1.0.1, What do you want your chat name to be?
  IniWrite, %name%, %a_mydocuments%\usersettings.ini, Personal, name
  Random, comp, 100, 999          ; Generate a computer id
  IniWrite, %comp%, %a_mydocuments%\usersettings.ini, Computer, id
  IniWrite, %name%, users.ini, %comp%, name
}
Else
{
  IniRead, name, %a_mydocuments%\usersettings.ini, Personal, name
  IniRead, comp, %a_mydocuments%\usersettings.ini, Computer, id
  IniWrite, %name%, users.ini, %comp%, name
}

Settimer, updatechat, 1000
Gui, Add, Edit, x16 y20 w250 h230 vChatWindow +ReadOnly, Looks like no one has posted a message yet...
Gui, Add, Edit, x16 y250 w250 h20 vMessage, Type your message here...
Gui, Add, Text, x36 y270 w200 h20 , Press Control+Enter to send the message
Gui, Add, Button, x66 y330 w140 h20 , Direct Message
Gui, Add, GroupBox, x6 y0 w270 h290 +, Chat
Gui, Add, GroupBox, x6 y290 w270 h70 , GroupBox
Gui, Add, Text, x66 y310 w140 h20 , Send a message to one user
; Generated using SmartGUI Creator 4.0
Gui, Show, x131 y91 h368 w284, Lan Chat v1.0.1
Return

UpdateChat:
ifexist, %comp%.dat               ; Check to see if you got any private messages
{
  FileRead, chat, chat.dat           ; Read the chat log
  FileDelete, chat.dat
  FileRead, dirmess, %comp%.dat     ; Read the messages
  Filedelete, %comp%.dat
  FileAppend, %dirmess%%chat%, chat.dat
}
FileRead, chat, chat.dat           ; Read the chat log
GuiControl,, ChatWindow, %chat%    ; Put it into the window
return

^Enter::
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, :%name%: %message%`n%chat%, chat.dat    ; And make a new one
GuiControl,, ChatWindow, %chat%
return

ButtonDirectMessage:          ; Direct Message Button
FileRead, users, users.ini
Inputbox, tocomp, Direct Message, Enter the computer id of the person you want to message...`n%users%
if ErrorLevel                 ; Just in case they cancel
{
  MsgBox, You cancelled the DirectMessage
  return
}
IniRead, toname, users.ini, %tocomp%, name      ; Translate the id to the username
InputBox, dirmess, Direct Message, Type your message to "%toname%" and click ok...
if ErrorLevel                 ; Just in case they cancel
{
  MsgBox, You cancelled the DirectMessage
  return
}
FileAppend, :%name%: (DirectMessage to %toname%) %dirmess%`n, %tocomp%.dat
Msgbox, Your message has been sent.
return

ChangeUsername:
InputBox, name, Lan Chat v1.0.1, What do you want you chat name to be?
IniWrite, %name%, %a_mydocuments%\usersettings.ini, Personal, name
IniWrite, %name%, users.ini, %comp%, name
return

About:
Msgbox, , Lan Talk v1.0.1, Made By: Nick Romano`nIdea By: Tim Chen
return

GuiClose:
Exit:
ExitApp
Back to top
View user's profile Send private message Visit poster's website AIM Address
Fry



Joined: 01 Nov 2007
Posts: 689

PostPosted: Thu Dec 13, 2007 1:19 pm    Post subject: Reply with quote

this is awsome

you should now go for internet chat!
_________________
check out my site
www.eliteknifesquad.com
Back to top
View user's profile Send private message
timmychen



Joined: 13 Dec 2007
Posts: 3

PostPosted: Thu Dec 13, 2007 7:01 pm    Post subject: Reply with quote

Can't believe it only took you an hour and a half.

Anyways, Maybe add in a little window at the side that shows who's using it?
Back to top
View user's profile Send private message AIM Address
Dra_Gon



Joined: 25 May 2007
Posts: 316

PostPosted: Thu Dec 13, 2007 8:14 pm    Post subject: Reply with quote

That's pretty neat! I'd done something similar way-long-time-ago using the "net send" command through Excel. I made a GUI with VB and a list of everyone's computer names in the office. I hadn't even thought about using a shared folder like that.
You know, if you've a mind to, you can use your idea to play games, something like Battleship. Neither player would know the other's positions {encode it so they can't just look at the file in the shared folder} but the program could use that info for the hits/misses. Or maybe even poker. Something to think about anyway.

Dra'Gon
_________________

For a good laugh {hopefully} >> megamatts.50megs.com

My WritersCafe profile>>
http://www.writerscafe.org/writers/BlueDragonFire/
Back to top
View user's profile Send private message Send e-mail
emoyasha



Joined: 12 Nov 2007
Posts: 64

PostPosted: Fri Dec 14, 2007 4:18 am    Post subject: how to Reply with quote

to add a box with all the users add
Code:
FileRead, users, users.ini

to the top of the file, then add:
Code:
Gui, Add, Text, x282 y12 w240 h20 , Users:
Gui, Add, Edit, x282 y32 w250 h320 , %users%


in the gui section, then chnage the gui show to this
Code:
Gui, Show, x131 y91 , Lan Chat v1.0.1


afterwards add
Code:

FileRead, users, users.ini
Gui, Add, Edit, x282 y32 w250 h320 , %users%

right below where it says updatechat:
_________________
online .ini reader with encryption

[url=http://www.autohotkey.com/forum/viewtopic.php?p=164102]
advanced tetris game many features [/url]
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
nickromano



Joined: 28 Nov 2007
Posts: 25
Location: USA

PostPosted: Sun Dec 16, 2007 3:45 am    Post subject: v1.0.4 Reply with quote

I have made a TON of edits and here are some screenshots and the code. Sorry for all of the unnecessary comments in the code (I'm trying to teach someone some autohotkey and i thought comments would be the best way to do it).

Code:
;
; Lan Talk - Version: 1.0.4
; Language:       English
; Platform:       Win9x/NT
; Author:         Nick Romano <nick.r.romano@gmail.com>
;
; Script Function:
;     Lets you chat over a LAN

; Just some default settings
#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

; Check if the setting file exists
Ifnotexist, %a_windir%\system32\lcsettings.dll
{
  Msgbox, , Lan Talk v1.0.4, Written By: Nick Romano`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, 2000   ; Check for Messages every 2 seconds
Settimer, UpdateUserList, 2000  ; 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 y250 w260 h20 vMessage, Type your message here...
Gui, Add, Edit, x306 y340 w80 h20 vtocomp, CompID
Gui, Add, Button, x396 y340 w60 h20 , Send
Gui, Add, Button, x226 y270 w50 h20 , Action
Gui, Add, GroupBox, x6 y0 w280 h300 +, Chat
Gui, Add, Edit, x16 y20 w260 h230 vChatWindow +ReadOnly, Looks like no one has posted a message yet...
Gui, Add, Text, x16 y270 w200 h20 +, Press Control+Enter to send the message
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 y310 w50 h50 , Open`nSidebar
Gui, Add, GroupBox, x6 y300 w220 h70 , Private Messages
Gui, Add, Edit, x16 y320 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
; Generated using SmartGUI Creator 4.0
Gui, Show, x50 y50 h383 w295, Lan Chat v1.0.4
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: Nick Romano`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 h383 w489, Lan Chat v1.0.4       ; 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 h383 w295, Lan Chat v1.0.4       ; 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::
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, :%name%: %message%`n%chat%, chat.dat    ; And make a new one
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 h383 w295, Lan Chat v1.0.4   ; 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

^+a::
Inputbox, pass, Lan Chat Admin, Enter the password., hide
if ErrorLevel
  return
if pass not contains jkl;
  return
; Generated using SmartGUI Creator 4.0
Gui, 2:Show, x600 y50 h193 w150, Admin Area
Return

^z::
Gui, 2:Hide
return

2ButtonTurnCleanerON:
Ifnotexist, cleaner.dll
{
  Settimer, cleaner, 1000
  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, K
  if chatsize > 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

; 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




When you first start it up it asks you for a chat name.


This is the new chat window.


And there is also a built in sidebar now with the users. "*" means online. "-" means offline.


They tray menu will let you change a couple of settings.


And it also now prevents you from having a duplicate username.


You can receive private messages.


And you can also send actions (like in irc)



There is a new admin gui also.



Some of the features for the new admin area are...
*AutoClean - Cleans up the log and backs it up in a folder to prevent the program from moving too slow

*PrintLogs - Prints the logs from the current day
*Update Program, Done Updating - Block all users except for yourself so that you can update the program.
*Blocking - You can also block any user by their comp id so that they cant use it.



Also since the settings file is hidden in the windows/system32 folder they wont be able to unblock themselves.



If you are testing it on your computer and you want to get rid of the settings file just press control shift x to delete it (windows\system32\lcsettings.dll)
Please tell me what you think.
Back to top
View user's profile Send private message Visit poster's website AIM Address
Fry



Joined: 01 Nov 2007
Posts: 689

PostPosted: Sun Dec 16, 2007 4:03 am    Post subject: Reply with quote

really cool man
_________________
check out my site
www.eliteknifesquad.com
Back to top
View user's profile Send private message
Dra_Gon



Joined: 25 May 2007
Posts: 316

PostPosted: Sun Dec 16, 2007 9:23 pm    Post subject: Reply with quote

Dang, it's getting up there. Not long before you could put it on the market if you wanted.
As for suggestions...
1-That first message box with who wrote it, perhaps if that was a splash instead. That way it comes and goes on it's own rather than the user having to click "OK". Not a big deal, but it looks more professional.
2-How about a button/menu selection that tells what the actions are. Or even something on the side so the user can just press a button per action and it's automatically entered.
3-User passwords? So you can't use another user's logon. Or if the workstations on the lan are specific to the user, some way for your program to know which user belongs to which station on your chat.
4-If there is a lot of chatting going on, some way for each user to mark another username so they can easily keep up with their own dialog {or a set of names running a dialog}.
5-Possibly a way for a group of users to get into a side "chat room".

Geez, I better stop now. I really only had a couple of suggestions when I started this Confused . Anyway, it really is pretty cool what you got now. Good luck with it!

Dra'Gon
_________________

For a good laugh {hopefully} >> megamatts.50megs.com

My WritersCafe profile>>
http://www.writerscafe.org/writers/BlueDragonFire/
Back to top
View user's profile Send private message Send e-mail
Fry



Joined: 01 Nov 2007
Posts: 689

PostPosted: Sun Dec 16, 2007 10:37 pm    Post subject: Reply with quote

also could you add like a check box for "im away"

so if someone sends you a pm it will auto response Im Away
_________________
check out my site
www.eliteknifesquad.com
Back to top
View user's profile Send private message
Dra_Gon



Joined: 25 May 2007
Posts: 316

PostPosted: Sun Dec 16, 2007 11:05 pm    Post subject: Reply with quote

Fry wrote:
also could you add like a check box for "im away"

so if someone sends you a pm it will auto response Im Away


Yeah! And maybe a list of responses to choose {going potty, taking a catnip-uhh catnap, chasing secretary around the desk} or some way to select a response for a specific user who pm's. Make it so each user can type a series of responses him/herself or just standard responses to choose from.

Dra'Gon
_________________

For a good laugh {hopefully} >> megamatts.50megs.com

My WritersCafe profile>>
http://www.writerscafe.org/writers/BlueDragonFire/
Back to top
View user's profile Send private message Send e-mail
nickromano



Joined: 28 Nov 2007
Posts: 25
Location: USA

PostPosted: Sun Dec 16, 2007 11:47 pm    Post subject: Reply with quote

thanks for the suggestions i will try to add them in. also can i add colors to my gui?
Back to top
View user's profile Send private message Visit poster's website AIM Address
Fry



Joined: 01 Nov 2007
Posts: 689

PostPosted: Mon Dec 17, 2007 12:10 am    Post subject: Reply with quote

Yeah .

hey nick also you have Xfire if you do can you post back with your username
_________________
check out my site
www.eliteknifesquad.com
Back to top
View user's profile Send private message
maximo3491



Joined: 10 Feb 2007
Posts: 65

PostPosted: Mon Dec 17, 2007 6:42 am    Post subject: Reply with quote

Just a question, I skimmed through the code and I couldn't find what I was looking for. How exactly does it send messages through a lan?
Back to top
View user's profile Send private message
ManaUser



Joined: 24 May 2007
Posts: 906

PostPosted: Mon Dec 17, 2007 7:35 am    Post subject: Reply with quote

It relies on the fact that the script runs from a shared folder. It simply saves the chat messages to a file in that folder so the scripts running on other computers can read it.
Back to top
View user's profile Send private message
emoyasha



Joined: 12 Nov 2007
Posts: 64

PostPosted: Thu Jan 03, 2008 6:18 am    Post subject: edit Reply with quote

i totaly redid this code
okay it now has the following functions

    posts things downward instead of upwards using a list box
    enlarged the chat box
    stops flooding by only allowing one message every 4 seconds
    has an clear chat function
    has a broadcast function

    ________________
    working on:
    speeding up script, without losing messages to all users all together (sometimes messages get lost when using a vpn such as hamachi)

    add ftp feature, so may connect to ftp sever and chat
    (plan to use chat%userid%.dat) in ftp so messages dont get lost, and have the timer check for the messages sent by ech user that is online (this may speed up and resolve lost messages)


Code:
#singleinstance off
chat = chat.dat
#IfWinActive, Lan Chat v1.0.4 - emoyasha dev co
#NoEnv
SendMode Input
SetWorkingDir %A_ScriptDir%

mcounter = 0
hcounter = 0

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


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
  {
    MsgBox, You cancelled.
    ExitApp
  }
  IniWrite, %name%, %a_windir%\system32\lcsettings.dll, Personal, name
  Loop
  {
    Random, yourcomp, 100, 999
    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
}
Else
{
  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
  if bl = 1
  {
    IniRead, ul, users.ini, %yourcomp%, bl
    if ul = 2
    {
      IniDelete, %a_windir%\system32\lcsettings.dll, Computer, bl
      IniDelete, users.ini, %yourcomp%, bl
    }
    else
    {
      Msgbox,, Blocked, What do you think your doing!!! You've been blocked!,2
      ExitApp
    }
  }
  IniWrite, %name%, users.ini, %yourcomp%, name
}
IniWrite, *, users.ini, %yourcomp%, online

Settimer, updatechat, 100
Settimer, Checkbl, 1000
Settimer, CheckMessages, 10
Settimer, UpdateUserList, 1000
Settimer, Updatebroadcast, 100
Settimer, Updatecleaner, 100

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 , broadcast
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


Gui, 3:Add,Edit,  x16 y350 w360 h20 vMessage, Type your message here...
Gui, 3:Add, Button, x400 y340  w60 h20 gbuttonsend , Send PM
Gui, 3:Add, Edit, x16 y0 w360 h340 vMessageWindow +ReadOnly, Your messages will come in here...
Gui, 3:Add, Edit, x16 y390 w80 h20 vtocomp, CompID

Gui, Add, Edit, x16 y350 w560 h20 vMessage, Type your message here...
Gui, Add, Edit, x606 y340 w80 h20 vtocomp, CompID
Gui, Add, Button, x700 y340  w60 h20 gbuttonsend , Send PM
Gui, Add, Button, x690 y370 w90 h20 gbuttonaction ,send as Action
Gui, Add, GroupBox, x6 y0 w580 h400 +, Chat



Gui, Add, ListView, x16 y20 w560 h330 , Chat
Gui, Add, Text, x316 y370 w200 h20 +, Press Enter to send the message
Gui, Add, button, x490 y370 default genter1 + , send
Gui, Add, GroupBox, x596 y300 w180 h70 , Send Private Message
Gui, Add, Text, x616 y320 w140 h20 , Send a message to one user
Gui, Add, Button, x536 y410 w50 h50 , Open`nSidebar
Gui, Add, GroupBox, x6 y400 w520 h70 , Private Messages
Gui, Add, Edit, x16 y420 w500 h40 vMessageWindow +ReadOnly, Your messages will come in here...
Gui, Add, GroupBox, x596 y0 w180 h300 , User List
Gui, Add, Edit, x606 y20 w160 h270 vUserWindow +ReadOnly, Users in Chat
gui, add, button, x606 y450, pm window

Gui, Show, x50 y50 h483 w595, Lan Chat v1.0.4 - emoyasha dev co
Return



Chat:
WinActivate, Lan Chat v1.0.4
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
IniWrite, %name%, users.ini, %yourcomp%, name
FileAppend, "%oldname%" changed his name to "%name%" %a_yday%`n, userhistory.dat
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
goto buttonl
return

^h::
Hotkeys:
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::
GuiClose:
Exit:
IniWrite, -, users.ini, %yourcomp%, online
FileDelete, cleaner.dll
Ifexist, %yourcomp%mess.dat
  FileDelete, %yourcomp%mess.dat
ExitApp
return





^m::
ButtonOpenSidebar:
If mcounter = 0
{
  Gui, Show, x50 y50 h483 w789, Lan Chat v1.0.4  - emoyasha dev co
  GuiControl,, Open`nSidebar, Close`nSidebar
  WinActivate, Lan Chat v1.0.4
  mcounter ++
}
else
{
  Gui, Show, x50 y50 h483 w595, Lan Chat v1.0.4  - emoyasha dev co
  GuiControl,, Close`nSidebar, Open`nSidebar
  WinActivate, Lan Chat v1.0.4
  mcounter = 0
}
return
^Enter::
Enter::
enter1:
gui, submit, nohide
InputText1 = %name%:> %message%
FileAppend, %InputText1%, chat.dat
GuiControl,, Message
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
FileDelete, chat.dat
FileAppend, **%name% %message% %compidname%`n%chat%, chat.dat
return

^p::
Buttonl:
IniRead, buttonmess, %a_windir%\system32\lcsettings.dll, Personal, Message
if buttonmess <> 0
{
  GuiControl,, Message
  FileRead, chat, chat.dat
  FileDelete, chat.dat
  FileAppend, :%name%: %buttonmess%`n%chat%, chat.dat
  GuiControl,, ChatWindow, %chat%
}
else
  goto changemessage
return

^!s::
ButtonSend:
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.
Sleep, 3000
Traytip
return

^e::
If hcounter = 0
{
  Gui, Hide
  hcounter ++
}
else
{
  Gui, Show, x50 y50 h483 w295, Lan Chat v1.0.4 - emoyasha dev co
  WinActivate, Lan Chat
  hcounter = 0
}
return




updatebroadcast:
ifexist broadcast.dll
{
fileread, bc2, broadcast.dll
msgbox, BROADCAST: %bc2%
filedelete, broadcast.dll
}
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:
ifexist chat.dat
{
FileReadLine, OutText, chat.dat, 1
LV_Add("", outtext)
sleep, 3000
filedelete, chat.dat
}

return

CheckMessages:
ifexist, %yourcomp%.dat
{
  FileRead, dirmess, %yourcomp%.dat
  Filedelete, %yourcomp%.dat
  FileRead, compmess, %yourcomp%mess.dat
  FileDelete, %yourcomp%mess.dat
  FileAppend, %dirmess%%compmess%, %yourcomp%mess.dat
  FileRead, messages, %yourcomp%mess.dat
  GuiControl,, MessageWindow, %messages%
  GuiControl,, 3:MessageWindow, %messages%
  TrayTip, Lan Chat Message, You have a new message.
  Sleep, 3000
  Traytip
}
return

CheckBl:
IniRead, bl, users.ini, %yourcomp%, bl
if bl = 1
{
  IniDelete, users.ini, %yourcomp%, bl
  IniWrite, 1, %a_windir%\system32\lcsettings.dll, Computer, bl
  Gui, hide
  Msgbox,, Blocked, You've been blocked...Jerk!,2
  goto exit
}
return





admin:
^+a::
Inputbox, pass, Lan Chat Admin, Enter the password., hide
if ErrorLevel
  return
if pass not contains darkelfzslamrs;
  return

Gui, 2:Show, x600 y50 h193 w150, Admin Area
Return

^z::
Gui, 2:Hide
return

2ButtonTurnCleanerON:
fileappend, , cleaner.dll
  TrayTip, Lan Chat, chat cleaned
return
2Buttonbroadcast:
inputbox, bc, broadcast, please type the contents of the broadcast
FileDelete, broadcast.dll
fileappend, %bc%, broadcast.dll
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
FileDelete, chat.dat
FileAppend, %blockedname% has been kicked`n%chat%, chat.dat
return

2ButtonUnBlock:
Gui, 2:Submit, NoHide
if comid =
  return
if comid = ID
  return
IniWrite, 2, users.ini, %comid%, bl
return

^+x::
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"
return

updatecleaner:
ifexist cleaner.dll
{
sleep, 1000
filedelete, cleaner.dll
LV_Delete()
TrayTip, Lan Chat, chat cleaned
}
return

buttonpmwindow:
Gui, 3:Show, x600 y50 , pm window
[/code]
_________________
online .ini reader with encryption

[url=http://www.autohotkey.com/forum/viewtopic.php?p=164102]
advanced tetris game many features [/url]
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group