I have an AHK script essentially copied from the following legacy post:
https://www.autohotkey.com/board/topic/41467-make-ahk-drop-files-into-other-applications/page-2#entry638376
It works perfectly on Word & Notepad++ when you hit F1, but not one DeepL pro, for which Window Spy provides the following info:
DeepL
ahk_class HwndWrapper[DeepL.exe;;68034f9f-2459-4cb3-b71d-a4376a3fed61]
ahk_exe DeepL.exe
ahk_pid 29056
This app for trial can be downloaded from:
https://www.deepl.com/pro?cta=header-pro/
Code: Select all
#SingleInstance force
GUI, Add, ListView, y+15 w450 H100, Files
gui, show
Gui +LastFound
; these work
;id := WinExist("F:\repos3\drop_on_deepl\hdrop.ahk - Notepad++")
;id := WinExist("Word")
id := WinExist("DeepL")
msgbox ,,, %id%, 3
return
GuiDropFiles:
LV_Delete()
Loop, parse, A_GuiEvent, `n, `r
LV_Add(, A_LoopField)
return
f1::
files := A_WorkingDir "\dropTestFile1.docx" "`n" A_WorkingDir "\dropTestFile2.docx"
;msgbox , %id%
; None works for "DeepL"
;PostMessage, 0x233, HDrop(files), 0,, ahk_id %id%
;PostMessage, 0x233, HDrop(files), 0,, ahk_class HwndWrapper[DeepL.exe;;68034f9f-2459-4cb3-b71d-a4376a3fed61]
;PostMessage, 0x233, HDrop(files), 0,, ahk_pid 29056
PostMessage, 0x233, HDrop(files), 0,, ahk_exe DeepL.exe
return
HDrop(fnames,x=0,y=0)
{
characterSize := A_IsUnicode ? 2 : 1
fns:=RegExReplace(fnames,"\n$")
fns:=RegExReplace(fns,"^\n")
hDrop:=DllCall("GlobalAlloc","UInt",0x42,"UInt",20+(StrLen(fns)*characterSize)+characterSize*2)
p:=DllCall("GlobalLock","UInt",hDrop)
NumPut(20, p+0) ;offset
NumPut(x, p+4) ;pt.x
NumPut(y, p+8) ;pt.y
NumPut(0, p+12) ;fNC
NumPut(A_IsUnicode ? 1 : 0, p+16) ;fWide
p2:=p+20
Loop,Parse,fns,`n,`r
{
DllCall("RtlMoveMemory","UInt",p2,"Str",A_LoopField,"UInt",StrLen(A_LoopField)*characterSize)
p2+=StrLen(A_LoopField)*characterSize + characterSize
}
DllCall("GlobalUnlock","UInt",hDrop)
Return hDrop
}