Hi,
I want to send some variables over internet to another PC, i know how to do it with WinHttp.Winhttprequest.5.1 and some PHP code on my server, but in this way I need to send a permanent requests to get the new variable. I think this is not a good solution for the Server bandwidth, so what I can use to send and get new variable over internet between 2 PC ?
Thanks,
Sorry for my poor english.
Connection between 2 PC with AHK ?
-
- Posts: 264
- Joined: 09 Mar 2019, 01:52
- Location: Germany
- Contact:
Re: Connection between 2 PC with AHK ?
If you want to communicate between two PCs you need something like a server and a client. In Python, I would use sockets (if they are not blocked by firewalls) and there is a AHK implementation:
https://autohotkey.com/board/topic/53827-ahksock-a-simple-ahk-implementation-of-winsock-tcpip/
There is a messenger with this solution. Take a look if you can use some code.
https://autohotkey.com/board/topic/86063-ahkmessenger-a-winsock-based-chat-serverclient-download/
But I have another idea. This AHKv2 script uses pastebin as a file exchange.
https://www.autohotkey.com/boards/viewtopic.php?f=6&t=63375&hilit=pastebin
So why not try to do the same. Push your variables to pastebin on the one side and pull them from the other side.
https://autohotkey.com/board/topic/53827-ahksock-a-simple-ahk-implementation-of-winsock-tcpip/
There is a messenger with this solution. Take a look if you can use some code.
https://autohotkey.com/board/topic/86063-ahkmessenger-a-winsock-based-chat-serverclient-download/
But I have another idea. This AHKv2 script uses pastebin as a file exchange.
https://www.autohotkey.com/boards/viewtopic.php?f=6&t=63375&hilit=pastebin
So why not try to do the same. Push your variables to pastebin on the one side and pull them from the other side.
Re: Connection between 2 PC with AHK ?
I already tried winsocket method, but the problem we need to open some ports in firewall, so this is not a good solution for me.
About pastebin, this is maybe a good idea but how we can get the new varable automatiquely and fastly without doing permanente requests ?
About pastebin, this is maybe a good idea but how we can get the new varable automatiquely and fastly without doing permanente requests ?
-
- Posts: 264
- Joined: 09 Mar 2019, 01:52
- Location: Germany
- Contact:
Re: Connection between 2 PC with AHK ?
Do I understand right? You have a script that runs all the time. And this script has to get the new variable a soon there is one. But this script should not check permanently the source.
So it's not a pull, it's a push from the other side. Therefore, the pastebin solution is not the best. And to be honest, at the moment I don't know how to trigger the script from another side without sockets.
So it's not a pull, it's a push from the other side. Therefore, the pastebin solution is not the best. And to be honest, at the moment I don't know how to trigger the script from another side without sockets.
-
- Posts: 264
- Joined: 09 Mar 2019, 01:52
- Location: Germany
- Contact:
Re: Connection between 2 PC with AHK ?
It's an interesting riddle. =)
Googleing I found this: https://autohotkey.com/board/topic/92898-need-help-with-communicating-between-scripts/#entry585770
This two scripts are communication on one PC with the OnMessage function. Very nice documentation: https://www.autohotkey.com/docs/commands/OnMessage.htm
At the end of the documentation is a link to the WinLIRC client https://www.autohotkey.com/docs/scripts/WinLIRC.htm. This seems to be a solution for you.
BUT! To enable this, there must be a direct connection through the internet from one PC to the other. Or the receiving PC must have a public address and the port it's providing must be accessible through the firewall. So it's the same problem with the socket connection. This is the main problem, not how to get two script to communicate.
Why not check in intervals like 10 minutes and only if there is a new variable pull it. I can't imagine that this cost so much bandwidth.
Googleing I found this: https://autohotkey.com/board/topic/92898-need-help-with-communicating-between-scripts/#entry585770
This two scripts are communication on one PC with the OnMessage function. Very nice documentation: https://www.autohotkey.com/docs/commands/OnMessage.htm
At the end of the documentation is a link to the WinLIRC client https://www.autohotkey.com/docs/scripts/WinLIRC.htm. This seems to be a solution for you.
BUT! To enable this, there must be a direct connection through the internet from one PC to the other. Or the receiving PC must have a public address and the port it's providing must be accessible through the firewall. So it's the same problem with the socket connection. This is the main problem, not how to get two script to communicate.
Why not check in intervals like 10 minutes and only if there is a new variable pull it. I can't imagine that this cost so much bandwidth.
-
- Posts: 440
- Joined: 28 Apr 2018, 21:59
Re: Connection between 2 PC with AHK ?
Telegram may be a solution to the problem. The following post talk about the automation and use of Telegram
https://www.autohotkey.com/boards/viewtopic.php?t=24919
https://www.autohotkey.com/boards/viewtopic.php?&t=42031&start=20
I believe what others have done is be able to send variables over via the Telegram api which triggers the Telegram bots to run processes on that computer. It has been a while since I have done it, but it should be possible. Also with this you shouldn't need to worry about the firewall since its coming from a browser.
If both of your computers have access to the same folder you could also just read from a specific folder connection, and just check it every so often.
https://www.autohotkey.com/boards/viewtopic.php?t=24919
https://www.autohotkey.com/boards/viewtopic.php?&t=42031&start=20
I believe what others have done is be able to send variables over via the Telegram api which triggers the Telegram bots to run processes on that computer. It has been a while since I have done it, but it should be possible. Also with this you shouldn't need to worry about the firewall since its coming from a browser.
If both of your computers have access to the same folder you could also just read from a specific folder connection, and just check it every so often.
Re: Connection between 2 PC with AHK ?
well... so there is no good solution, i can't open ports and i can't use telegram because ill need a phone number.
But maybe i found something good, what about using a server with some PHP code and Ajax code like Comet/Ajax push to push new variables.
I probably need to use a hidden web page or maybe using ActiveX ?
But maybe i found something good, what about using a server with some PHP code and Ajax code like Comet/Ajax push to push new variables.
I probably need to use a hidden web page or maybe using ActiveX ?
Who is online
Users browsing this forum: iamasink, jollyjoe, peter_ahk, RareUserGerman, Rohwedder and 314 guests