AutoHotkey Community

It is currently May 27th, 2012, 5:54 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: September 8th, 2010, 4:11 am 
Offline

Joined: June 12th, 2009, 11:36 pm
Posts: 1173
Location: Indianapolis IN, USA
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. :) 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.
Image


Last edited by Eedis on September 8th, 2010, 8:38 pm, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 8th, 2010, 8:19 pm 
Offline

Joined: February 17th, 2008, 5:01 pm
Posts: 303
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 inthe AHKSock post, but I'd only suggest this if you are looking for a challenge.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 8th, 2010, 8:36 pm 
Offline

Joined: June 12th, 2009, 11:36 pm
Posts: 1173
Location: Indianapolis IN, USA
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. :) Although, I have added a tooltip to pop up when you get a new message to let the user know of one. :)

_________________
www.AutoHotkey.net/~Eedis
I love my wife and daughter so much.
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 25th, 2010, 6:47 pm 
Offline

Joined: August 18th, 2009, 12:07 pm
Posts: 375
Location: holland
you talk via the computer while you are in the same house! :shock: I hope you talk for real sometimes!

_________________
"Choose your parents wisely"


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Apollo, Exabot [Bot], Google Feedfetcher, JamixZol and 21 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group