Jump to content
Sign in to follow this  
Lemures

Little Messages

Recommended Posts

Lemures

Ok... i have been working with autoit for a while, never on anything TOO advanced though, but i have just now decided to get into using au3xtra.dll and the GUI things. right now i would like to be able to let another computer know when an event takes place, but without the user being aware of it. for example:

user "HelloWorld" signs on on AOL instant messenger, which is running on Comp1. (this is checked using autoit)

Comp1 lets Comp2 know of the event.

Comp2 boots up AOL instant messenger and direct connects with "HelloWorld".

ok so that was way to complicated of an example. but hopefully you get the idea... i just need to be able to let a comp know that a certain event has happened, so it should be able to send it a short message or something. how can i do this?

Share this post


Link to post
Share on other sites
Insolence

I think you can send messages via TCP/IP, not sure though.

Try searching for TCP/IP on the forums.


"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.

Share this post


Link to post
Share on other sites
Helge

You could read and write the information to a INI-file located on a shared

directory in your network. Easy way to communicate.

Another way to do it, is to use (like Insolence said) the TCP/IP functions that

Larry has created for use with the AutoIt's DLLCall(), which probably is

the best way..

Good luck !

Find Au3Xtra.dll here.. (TCP/IP-functions and more)

- Helge -

Edited by Helge

Share this post


Link to post
Share on other sites
Lemures

hmm.. ive been messing with this dll for the past 2 adn a half hour or so... i cant seem to figure this out, lol. how do i simply send a message, and then receive it?

Share this post


Link to post
Share on other sites
Helge

A test I made earlier (Based on Larry's scripts)..

Remember to change the IP-address in both the client- and server-scripts

before running them. Set it to the server-address in both..

Server

;EXAMPLE SERVER CODE using AU3Xtra.DLL
;======================================

Global $WSABASEERR = 10000
Global $g_PORT = 65432
Global $g_IP = "192.168.0.181"
Global $socket = 0

HotKeySet("{scrolllock}","Bye")

;Start the TCP abilities
;-----------------------
$x = DLLCall( "AU3Xtra.dll", "int", "TCPStartUp" )
If @error Or $x[0] = 0 Then MsgBox(64,"","what !!!")

;Wait for connections
;-----------------------
$x = DLLCall( "AU3Xtra.dll", "int", "TCPListen",_
              "str", $g_IP,_
              "int", $g_PORT )
If @error Then CleanUp(0)
$socket = $x[0]


;Wait For Window Title
;   or disconnection.
;---------------------------------------------------------
While 1
   $x = DLLCall( "AU3Xtra.dll", "int", "TCPSend",_
   "int", $socket,_
   "str",@HOUR & ":" & @MIN & @SEC)
   $err = @error
   If Not $err And $x[0] >= $WSABASEERR Then Exit
   Sleep(900)
WEnd


;CleanUp() is a wrapper for TCPShutDown
;--------------------------------------
CleanUp($socket)


;FUNCs
;++++++++++++++++++++++++++++++++++++++

Func CleanUp($CU_SOCKET)
   DLLCall( "AU3Xtra.dll", "int", "TCPShutDown",_
                         "int", $CU_SOCKET)
   Exit
EndFunc

Func Bye()
   CleanUp($socket)
   Exit
EndFunc

Client

;EXAMPLE SERVER CODE using AU3Xtra.DLL
;=====================================
#include <GUIConstants.au3>

$wTitle = "Server Clock"

Global $WSABASEERR = 10000
Global $g_PORT = 65432
Global $g_IP = "192.168.0.181"
Global $socket = 0

HotKeySet("{scrolllock}","Bye")

;Start the TCP abilities
;-----------------------
$x = DLLCall( "AU3Xtra.dll", "int", "TCPStartUp" )
If @error Or $x[0] = 0 Then Exit


;Wait for a connection
;-----------------------
$x = DLLCall( "AU3Xtra.dll", "int", "TCPConnect",_
                             "str", $g_IP,_
                             "int", $g_PORT )
If @error Or $x[0] < 0 Then CleanUp(0)
$socket = $x[0]


;Send InputBox() contents to SERVER
;----------------------------------
While 1
   $x = DLLCall( "AU3Xtra.dll", "int", "TCPRecv",_
                                "int", $socket,_
                                "str", "",_
                                "int", 1024 )
   If Not @error Then
      If $x[0] >= $WSABASEERR Then ExitLoop
      ToolTip("Server clock : " & $x[2] & @CRLF & @CRLF & "Scrolllock to close..",0,0)
   Else
      ExitLoop
   EndIf
   Sleep(500)
WEnd


;CleanUp() is a wrapper for TCPShutDown
;--------------------------------------
CleanUp($socket)


;FUNCs
;++++++++++++++++++++++++++++++++++++++

Func CleanUp($CU_SOCKET)
   DLLCall( "AU3Xtra.dll", "int", "TCPShutDown" ,"int", $CU_SOCKET)
   Exit
EndFunc

Func Bye()
   CleanUp($socket)
   Exit
EndFunc

Good luck !

Share this post


Link to post
Share on other sites
Lemures

*sigh*

im stupid.

laptop = .1.104

main comp = .1.101

where do i put the server, where do i put the client, and what should each ones ip be set to? im not sure if i understand how the ip is being use. should the ips on the main comp be set to 104?

Share this post


Link to post
Share on other sites
buzz44

you can send messages to other computer that are connectected to your network using cmd.

"net send (ip address or computer name) (msg)"

there are also other various commands that can provide a list of all the computers networked, if that helps, we used to do this at school as we werent aloud to use chat prog's but we could do this to chat,


qq

Share this post


Link to post
Share on other sites
buzz44

forgot to add, you should check out winchat.exe, should be located in c:\windows\system32\, its a network chat program


qq

Share this post


Link to post
Share on other sites
Lemures

i have net send disabled, else i would use that (its disabled to prevent ads, and my stupid friends who like screwing with people =P)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.