Page 3 of 3

Re: XYplorer Messenger (using AHK language)

Posted: 09 Sep 2022 12:41
by klownboy
Yes, it should be fine now. See this thread for some background. viewtopic.php?f=2&t=25041 and notes for beta v23.50.0203 - 2022-08-25 12:36.

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

Re: XYplorer Messenger (using AHK language)

Posted: 02 Oct 2022 11:20
by nerdweed
Hey,

Have you got this to work on AHKv2

Re: XYplorer Messenger (using AHK language)

Posted: 02 Oct 2022 12:44
by klownboy
No, I haven't tried AHK version 2 beta. I've stuck with 1.1.XX Ansi 32-bit version for ages...no particular reason though. Maybe one of the other XY forum members have used AHK beta version 2.

EDIT: I did end up downloading and trying version 2, but I encountered a slew of errors in my AHK startup script which includes the messenger along with a bunch of other things.

Re: XYplorer Messenger (using AHK language)

Posted: 03 Oct 2022 08:09
by nerdweed
Yes, there are few changes which can be checked here. I've compled the MessageToXY as below. I never used MessageFromXYplorer, so need to check on it.

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
}

Re: XYplorer Messenger (using AHK language)

Posted: 03 Oct 2022 08:32
by nerdweed
Full Script for AHK2

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
}

Re: XYplorer Messenger (using AHK language)

Posted: 03 Oct 2022 14:37
by klownboy
Thanks nerdweed for updating the XYplorer messenger AHK script and posting it. I wonder if that script version will work in AHK version 1.1 (i.e., backward compatible)? I may try it when I get a chance.

Re: XYplorer Messenger (using AHK language)

Posted: 03 Oct 2022 16:19
by Horst
Reading the version 2 description and changes from v1
I don't think there are any default combatibilty backward.
That will be one of the big problems getting v2 to replace the v1 line.

Re: XYplorer Messenger (using AHK language)

Posted: 04 Oct 2022 06:42
by nerdweed
It won't work on AHK1.1

Re: XYplorer Messenger (using AHK language)

Posted: 07 Feb 2023 19:34
by kko
nerdweed wrote: 04 Oct 2022 06:42 It won't work on AHK1.1
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
}