RemoteObj.ahk - Access objects remotely over a TCP/IP network

Post your working scripts, libraries and tools
GeekDude
Posts: 858
Joined: 02 Oct 2013, 22:13

RemoteObj.ahk - Access objects remotely over a TCP/IP network

30 Jul 2017, 19:10

RemoteObj.ahk

Access objects remotely over a TCP/IP network. See it in action on Imgur!

Dependencies
Usage

Publishing an Object to the Network

Code: Select all

ObjToPublish := new Test() ; This is the object that will be published
Bind_Addr := "127.0.0.1" ; Only accept connections from localhost
Bind_Port := 1337 ; Listen for connections on port 1337

Server := new RemoteObj(ObjToPublish, [Bind_Addr, Bind_Port])

class Test {
	InputBox(Prompt) {
		InputBox, Out, % this.Title, %Prompt%
		return Out
	}
}
Connecting to a Published Object

Code: Select all

Remote_Addr := "127.0.0.1" ; Connect to local host
Remote_Port := 1337 ; Connect to port 1337

Remote := new RemoteObjClient([Remote_Addr, Remote_Port])

Remote.Title := "Hello World!"
MsgBox, % Remote.InputBox("Type something!")
Related Projects
  • GeekBot uses RemoteObj.ahk for its plugins, and for integration with PHP and Python

Download
tmplinshi
Posts: 1557
Joined: 01 Oct 2013, 14:57

Re: RemoteObj.ahk - Access objects remotely over a TCP/IP network

27 Aug 2017, 03:43

Thank you! Very easy to use.

An example of connecting to server using computer name:

Server:

Code: Select all

ObjToPublish := new Test() ; This is the object that will be published
Bind_Addr := A_IPAddress1 ; Local IP (it looks like 192.168.1.xxx)
Bind_Port := 1337 ; Listen for connections on port 1337

Server := new RemoteObj(ObjToPublish, [Bind_Addr, Bind_Port])

class Test {
	InputBox(Prompt) {
		InputBox, Out, % this.Title, %Prompt%
		return Out
	}
}
Client:

Code: Select all

Ping4("The_Server_Computer_Name", Result) ; Ping4 by just me -- https://autohotkey.com/boards/viewtopic.php?f=6&p=167334
If (ErrorLevel) {
	MsgBox, 16, Ping4, Error:`r`n%ErrorLevel%
	ExitApp
}

Remote_Addr := Result.IPAddr
Remote_Port := 1337 ; Connect to port 1337

Remote := new RemoteObjClient([Remote_Addr, Remote_Port])

Remote.Title := "Hello World!"
MsgBox, % Remote.InputBox("Type something!")
User avatar
joedf
Posts: 7555
Joined: 29 Sep 2013, 17:08
Facebook: J0EDF
Google: +joedf
GitHub: joedf
Location: Canada
Contact:

Re: RemoteObj.ahk - Access objects remotely over a TCP/IP network

21 Nov 2017, 21:20

I absolutely love it! :+1:
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x8GB G.Skill RipJaws V - DDR4 3280 MHz | [About Me] | [ASPDM - StdLib Distribution]
[Populate the AHK MiniCity!] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library] | [About the AHK Foundation]
blue83
Posts: 100
Joined: 11 Apr 2018, 06:38

Re: RemoteObj.ahk - Access objects remotely over a TCP/IP network

23 May 2020, 04:54

Hi @GeekDude and @tmplinshi ,

How can I send only string or variable back and forth without gui?

Also not only one varible, but one, two or more?

Also this is not working when I am outside of company. Why?
Is there command for timeout if client can not be connected to server?

Thanks,
Blue

Return to “Scripts and Functions”

Who is online

Users browsing this forum: dieissonc, robodesign and 38 guests