Sign in to follow this  
Followers 0
zykl0

Sending command to another computer

16 posts in this topic

Hello! i was wondering if there is a way to send some command to another script running on another computer on the same network.

id like to send keypress from primary computer to secondary

eg. on primary comp i press the key "V" to call my mount

and instantly the secondary comp press the V key also.

i dont want the second computer to mimic everything but only some predefined key. is there a way?

Share this post


Link to post
Share on other sites



Via internet I don't think it is possible. Maybe with LAN, but I don't know how. Sorry


Random

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Yes, you can do this via TCP() functions. You could have your primary computer as the server and the secondary as the client. When you press a certain key, the server would send a message via TCPSend() to the client. The client would then TCPRecv() it and then it would know to press that key. It would then Send() that key and the client computer would also press that key. Look at the TCP functions in the help file for more information. AutoIt Smith also wrote a little TCP help guide on the forum. I would look for that too.

Edited by The Kandie Man

"So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire

Share this post


Link to post
Share on other sites

Does tcp work with a router ? I forwarded ports, and it's still not working :/


My programs:[topic="40019"]Sudoku[/topic], [topic="41258"]Suitcase game & Random jokes[/topic], [topic="41641"]8 Queens[/topic], [topic="41679"]Puzzle Generator[/topic], [topic="42045"]Snake[/topic]My UDFs:[topic="41309"]Prime functions & Prime game[/topic]Other:Fake emailer

Share this post


Link to post
Share on other sites

Does tcp work with a router ? I forwarded ports, and it's still not working :/

Well if its over the LAN you should have to forward anything.. portforwarding is when you try to connect to your pc from the internet


Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit

Share this post


Link to post
Share on other sites

use 2 msn and have one monitor the control on msn for text like start.

Share this post


Link to post
Share on other sites

use 2 msn and have one monitor the control on msn for text like start.

This is a stupid idea. TCP is the way to go, it can be real easy if you study an example script. If I have time (I gotta go soon), I will post a quick example.

Kurt


Awaiting Diablo III..

Share this post


Link to post
Share on other sites

I had enough time. I've tested this and it does infact work. Once the computers are "connected", if you press a button on the first computer, the second computer will send the letter V. You can basically completely control the other computer through TCP, you just need to modify the DefaultFunction().

This script will run on the computer that you control:

;Note that you must know the other computer's IP address
;before you can successfully run this. To do this, run
;the other script on the other computer and a MsgBox will
;pop-up indicating it's IP.

#include <GUIConstants.au3>

TCPStartup()
$ipAddress = InputBox("","Enter ip address to connect with:",@IPAddress1)
If $ipAddress = "" Then $ipAddress = @IPAddress1
$portAddress = 666

$connectedSocket = TCPConnect($ipAddress, $portAddress) ;Connect with the other computer
If @error OR $connectedSocket < 1 Then                  ;If there was a problem connecting, notify the user.
    MsgBox(0, "GUI Event", "Could not connect to IP: " & $ipAddress & " and PORT: " & $portAddress)
    Exit
EndIf

GUICreate("Test", 120, 60)                                         ;Create a GUI
$input    = GUICtrlCreateInput("DefaultFunction", 0, 0, 120, 20)   ;Create Controls within the GUI
$function = GUICtrlCreateButton("Send The Function", 0, 20, 120, 20)
$exit     = GUICtrlCreateButton("End Session", 0, 40, 120, 20)
GUISetState()

While 1
    $msg = GUIGetMsg()
    $portAddress = 13013
    Select
        Case $msg = $function                                 ;If the user clicks on "Send The Function" button,
            $message = "SEND FUNCTION: " & GUICtrlRead($input);Send to the other computer text
            TCPSend($connectedSocket,$message)                ;See other script to see what happens once it receives the text
        Case $msg = $exit        ;If "End Session" button is clicked
            $message = "EXIT:"   ;Send the other computer text, this will exit the other computers script
            TCPSend($connectedSocket,$message)
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
    EndSelect
WEnd 

TCPShutdown()oÝ÷ Ø   ݶ¬±Êâ¦Û!¢é]®éèØ^ªê-+Þªê-r©º×«jëh×6TCPStartup()

$ipAddress = @IPAddress1
$portAddress = 666
MsgBox(4096, "", "Listening on IP: " & $ipAddress & " and PORT: " & $portAddress)

$MainSocket = TCPListen($ipAddress, $portAddress)

While 1
    Do
        $ConnectedSocket = TCPAccept($MainSocket)
    Until $ConnectedSocket > 0
    
    $err = 0
    Do
        $msg = TCPRecv($ConnectedSocket,512)
        $err = @error
        If StringLen($msg) Then ;If we receive a message
            If StringInStr($msg, "SEND FUNCTION:") Then ;If the message contains the text "SEND FUNCTION:"
                $function = StringReplace($msg, "SEND FUNCTION: ", "");Delete the "SEND FUNCTION: " part so we $function
                ;                                                      now contains the function we want to do.
                Call($function)                                       ;"run" the function that was received
            EndIf
            If StringInStr($msg, "EXIT:") THEN                        ;If the message contains "EXIT:"
                TCPShutdown()                                         ;Stop connection
                Exit                                                  ;Exit script.
            EndIf
        EndIf
    Until $err ;We basically keep on "receiving" information until TCPShutdown is called, which only happens if
    TCPCloseSocket($ConnectedSocket) ;the other user presses "End Session"
WEnd

Func DefaultFunction()
    Send("V");You can do whatever you want to do to the "other" computer, in this case send the letter V.
EndFunc

Hope that helps, I commented some of the stuff.

Kurt

[Note: I am not the greatest at TCP, but this works :)]


Awaiting Diablo III..

Share this post


Link to post
Share on other sites

that doesnt seem very secure at all

Share this post


Link to post
Share on other sites

that doesnt seem very secure at all

What do you mean by secure? This has nothing to do with security.

Kurt


Awaiting Diablo III..

Share this post


Link to post
Share on other sites

works for me

Share this post


Link to post
Share on other sites

is there any way to get a gui that will display a video of whats happen on the remote computer...

Share this post


Link to post
Share on other sites

I don't believe that could be accomplished completely with AutoIt. Maybe not even partially with AutoIt... Have a look for a program called Camtasia, I used it once a long time ago (in a galaxy far far away), I believe the last version I had came with the ability to stream a video of your desktop like a webcam (say through MSN for example).

Share this post


Link to post
Share on other sites

C:\WINDOWS\system3\mstsc.exe "Remote Desktop Connection"

this works just fine but i wanted something to play with in autoit...

if the kid that started this post still needs a program to controle his other computer mstsc.exe will work

Share this post


Link to post
Share on other sites

there is know way you can use autoit and mstscax.dll to get a clean video picture of your remote desktop

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  
Followers 0