Jump to content

Little Messages


Lemures
 Share

Recommended Posts

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?

Link to comment
Share on other sites

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.
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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 !

Link to comment
Share on other sites

*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?

Link to comment
Share on other sites

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

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...