Interprocess Communication

121 views
Skip to first unread message

Right “Rightclick” Click

unread,
Oct 17, 2022, 5:09:41 PM10/17/22
to AutoControl
Is there a way to send a window message from and Autocontrol script to an external window?

I want to execute dynamically created Autohotkey scripts from Autocontrol scripts. Currently I execute a "named script" with the commands as a parameter but this has the overhead of starting a new Autohotkey process for each request. 

autocontro...@gmail.com

unread,
Oct 17, 2022, 8:57:08 PM10/17/22
to AutoControl
The scripting API doesn't allow to send window messages, but it's possible to achieve some sort of inter-process communication via the clipboard or via a file.
For example, you can use ACtl.setClipboard() to put content in the clipboard and then detect the clipboard change from your AHK script.
You could also use ACtl.saveFile() to write to a file or a named pipe and then form your AHK script you can detect when there's new data in the file or named pipe.

Right “Rightclick” Click

unread,
Oct 18, 2022, 1:45:15 PM10/18/22
to AutoControl
Can you provide a basic example of using a named pipe from the AutoControl side? Can this pipe be used in both directions to send and receive messages?

AutoControl support

unread,
Oct 18, 2022, 5:40:56 PM10/18/22
to AutoControl
You can send data through a name pipe like this:
await ACtl.saveFile("\\\\.\\pipe\\myPipeName", data, {append:true})
Obviously, the pipe must already exist. You have to create it first in your AHK script with the "CreateNamedPipe" WinAPI function.

Unfortunately, it's not possible to read data from a pipe because the ACtl.getFile() function wasn't implemented to handle pipes.

Right “Rightclick” Click

unread,
Oct 20, 2022, 4:18:16 AM10/20/22
to AutoControl
Thanks
Reply all
Reply to author
Forward
0 new messages