XYplorer Messenger (using AHK language)

Discuss and share scripts and script files...
klownboy
Posts: 4109
Joined: 28 Feb 2012 19:27

Re: XYplorer Messenger (using AHK language)

Post 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. :)
Windows 11, 22H2 Build 22621.1555 at 100% 2560x1440

nerdweed
Posts: 648
Joined: 25 Feb 2012 07:47

Re: XYplorer Messenger (using AHK language)

Post by nerdweed »

Hey,

Have you got this to work on AHKv2

klownboy
Posts: 4109
Joined: 28 Feb 2012 19:27

Re: XYplorer Messenger (using AHK language)

Post 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.
Windows 11, 22H2 Build 22621.1555 at 100% 2560x1440

nerdweed
Posts: 648
Joined: 25 Feb 2012 07:47

Re: XYplorer Messenger (using AHK language)

Post 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
}

nerdweed
Posts: 648
Joined: 25 Feb 2012 07:47

Re: XYplorer Messenger (using AHK language)

Post 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
}

klownboy
Posts: 4109
Joined: 28 Feb 2012 19:27

Re: XYplorer Messenger (using AHK language)

Post 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.
Windows 11, 22H2 Build 22621.1555 at 100% 2560x1440

Horst
Posts: 1085
Joined: 24 Jan 2021 12:27
Location: Germany

Re: XYplorer Messenger (using AHK language)

Post 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.
Windows 11 Home x64 Version 23H2 (OS Build 22631.3374)
Portable XYplorer (actual version, including betas)
Everything 1.5.0.1371a (x64), Everything Toolbar 1.3.2, Listary Pro 6.3.0.69

nerdweed
Posts: 648
Joined: 25 Feb 2012 07:47

Re: XYplorer Messenger (using AHK language)

Post by nerdweed »

It won't work on AHK1.1

kko
Posts: 7
Joined: 15 Apr 2016 05:35

Re: XYplorer Messenger (using AHK language)

Post 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
}

Post Reply