Edit: Sorry, I hadn't noticed jupe responded already.

Code: Select all
MsgToXY(msg) {
HWND := WinExist("XYplorer ahk_class ThunderRT6FormDC")
If !(HWND)
Return 1
Size := StrLen(msg)
buf := Buffer(3*A_PtrSize + Size*A_PtrSize) ; Size of Pointer + Size of Length + Size of Message
NumPut "Ptr", 4194305, buf
NumPut "UInt", Size*2, buf, A_PtrSize
NumPut "Ptr", StrPtr(msg), buf, A_PtrSize*2
SendMessage 0x004a, 0, buf, , "ahk_id " HWND
Return 0
}
Code: Select all
SenderHWND := A_ScriptHwnd + 0
OnMessage(0x004a, MsgFromXY)
MsgToXY("::copydata " . SenderHWND . ", <curitem>")
MsgToXY(msg) {
HWND := WinExist("XYplorer ahk_class ThunderRT6FormDC")
If !(HWND)
Return 1
Size := StrLen(msg)
buf := Buffer(3*A_PtrSize + Size*A_PtrSize) ; Size of Pointer + Size of Length + Size of Message
NumPut "Ptr", 4194305, buf
NumPut "UInt", Size*2, buf, A_PtrSize
NumPut "Ptr", StrPtr(msg), buf, A_PtrSize*2
SendMessage 0x004a, 0, buf, , "ahk_id " HWND
Return 0
}
MsgFromXY(wParam, lParam, msg, hwnd) {
StringAddress := NumGet(lParam, 2*A_PtrSize, "Ptr")
CopyOfData := StrGet(StringAddress)
cbData := NumGet(lParam, A_PtrSize, "UInt")/2
DataReceived := SubStr(CopyOfData, 1, cbData)
MsgBox(DataReceived)
Return DataReceived
}
Full Script for AHK1 - Tried to match it as best I could to the v2 version.
Code: Select all
#SingleInstance, force
SetTitleMatchMode, 2
DetectHiddenWindows, On
SenderHWND := A_ScriptHwnd + 0 ;Return this script's hidden hwdn id. +0 to convert from Hex to Dec
OnMessage(0x4a, "MsgFromXY")
MessagetoXYplorer := "::CopyData " SenderHWND ", ""<curitem>"", 2"
; MessagetoXYplorer := "::msg Hello"
MsgToXY(MessagetoXYplorer)
MsgToXY(msg) {
HWND := WinExist("XYplorer ahk_class ThunderRT6FormDC")
If !(HWND) {
MsgBox % "XYplorer not found"
Return 1
}
Size := StrLen(msg)
VarSetCapacity(buf, 3*A_PtrSize + Size*A_PtrSize, 0) ; Size of Pointer + Size of Length + Size of Message
NumPut(4194305, buf, 0, "Ptr")
NumPut(Size*2, buf, A_PtrSize, "UInt")
NumPut(&msg, buf, A_PtrSize * 2, "Ptr")
SendMessage 0x4a, 0, &buf, , ahk_id %HWND%
Return 0
}
MsgFromXY(wParam, lParam, msg, hwnd) {
StringAddress := NumGet(lParam + 2*A_PtrSize, "Ptr")
CopyOfData := StrGet(StringAddress)
cbData := NumGet(lParam + A_PtrSize, "UInt")/2
DataReceived := SubStr(CopyOfData, 1, cbData)
MsgBox % DataReceived
Return DataReceived
}