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 

Messenger application to chat over network.

 
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
Eedis



Joined: 12 Jun 2009
Posts: 1158
Location: Indianapolis IN, USA

PostPosted: Wed Sep 08, 2010 3:11 am    Post subject: Messenger application to chat over network. Reply with quote

My wife and I were tired of using Facebook chat whenever we wanted to use both the computer, which are in separate rooms. So I made this simple application so we could talk via the network. Smile Enjoy

Some configuring is required, see comments.

Code:

File=-NETWORK DIR HERE-\data.txt ;Change this to what ever directory is being shared with the other computer.
Name:=A_ComputerName ;Comment this if you want to choose your own name in the chat. This is just to make things more simple.
;InputBox, Name, Username, Please enter a username. ;Uncomment this to choose your own name.
Gui, Color, FF8040
FileRead, Data, %File%
Gui, Add, Edit, ReadOnly -BackgroundTrans +Border vTextData w500 h500, %Data%
Gui, Add, Edit, vTextInput  x10 y515 w400 h100,
Gui, Add, Button, gSend x415 y515 w95 h100, Send
Gui, Show,, Network E-Chatter
WinGet Gui_ID, ID, A
SetTimer, ParseData, 500
Return

Send:
$Enter::
Gui, Submit, Nohide
IfWinNotActive, Network E-Chatter
{
   Send, {Enter}
   Return
}
If (TextInput = "/del log")
{
   FileDelete, %File%
   FileAppend,, %File%
   GuiControl,, TextInput,
   Return
}
FileAppend, %name%:`n%TextInput%`n`n, %File%
GuiControl,, TextInput,
Return

ParseData:
FileRead, Data, %File%
If (Data <> LastData)
{
   GuiControl,, TextData, %Data%
   GuiControl Focus, TextData
   ControlGetFocus ClassLog, ahk_id %Gui_ID%
   ControlSend %ClassLog%, ^{End}, ahk_id %Gui_ID%
   GuiControl Focus, TextInput
        TrayTip, New message!
        Sleep 500
        TrayTip
}
LastData=%Data%
Return

GuiClose:
ExitApp


Any suggestions, comments, bug reports would be AWESOME! And thanks to MasterFocus for pointing me to Jaco's solution to auto scrolling the edit field. MasterFocus always seems to answer most of my questions. :p
_________________
www.AutoHotkey.net/~Eedis
I love my wife and daughter so much.


Last edited by Eedis on Wed Sep 08, 2010 7:38 pm; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail Visit poster's website
JoeSchmoe



Joined: 17 Feb 2008
Posts: 303

PostPosted: Wed Sep 08, 2010 7:19 pm    Post subject: Reply with quote

Nice code. Very simple and easy to read, which I like. It's too easy to get caught up in the bells and whistles when a simpler solution just works.

You may want to mention in the initial post that it requires a shared drive, and perhaps add a sentence about how it uses a file on the shared drive to transfer the info.

Code:
IfWinNotActive, Network E-Chatter
{
   Send, {Enter}
   Return
}
My inclination would be to replace this with #IfWinActive, but I guess that there isn't any real reason to do this.

You could probably increase performance and decrease resource utilization a lot by switching to something based off of Example 3 in the AHKSock post, but I'd only suggest this if you are looking for a challenge.
Back to top
View user's profile Send private message
Eedis



Joined: 12 Jun 2009
Posts: 1158
Location: Indianapolis IN, USA

PostPosted: Wed Sep 08, 2010 7:36 pm    Post subject: Reply with quote

Hmm... I'll have to look into that if I ever get the spare time. I'm not really looking for much optimization, if it works for what I need, it'll do fine. Smile Although, I have added a tooltip to pop up when you get a new message to let the user know of one. Smile
_________________
www.AutoHotkey.net/~Eedis
I love my wife and daughter so much.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Chicken Pie 4 Tea



Joined: 18 Aug 2009
Posts: 375
Location: holland

PostPosted: Sat Sep 25, 2010 5:47 pm    Post subject: Reply with quote

you talk via the computer while you are in the same house! Shocked I hope you talk for real sometimes!
_________________
"Choose your parents wisely"
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Page 1 of 1

 
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