 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Eedis
Joined: 12 Jun 2009 Posts: 1158 Location: Indianapolis IN, USA
|
Posted: Wed Sep 08, 2010 3:11 am Post subject: Messenger application to chat over network. |
|
|
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.

Last edited by Eedis on Wed Sep 08, 2010 7:38 pm; edited 1 time in total |
|
| Back to top |
|
 |
JoeSchmoe
Joined: 17 Feb 2008 Posts: 303
|
Posted: Wed Sep 08, 2010 7:19 pm Post subject: |
|
|
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 |
|
 |
Eedis
Joined: 12 Jun 2009 Posts: 1158 Location: Indianapolis IN, USA
|
Posted: Wed Sep 08, 2010 7:36 pm Post subject: |
|
|
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.
 |
|
| Back to top |
|
 |
Chicken Pie 4 Tea
Joined: 18 Aug 2009 Posts: 375 Location: holland
|
Posted: Sat Sep 25, 2010 5:47 pm Post subject: |
|
|
you talk via the computer while you are in the same house! I hope you talk for real sometimes! _________________ "Choose your parents wisely" |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|