F4MiniMenu (AHK): F4Menu w. Drag&Drop, filelist, cmdline

Discuss and announce Total Commander plugins, addons and other useful tools here, both their usage and their development.

Moderators: sheep, Hacker, Stefan2, white

Post Reply
dindog
Member
Member
Posts: 197
Joined: 2010-10-18, 07:41 UTC

Re: F4MiniMenu (AHK): F4Menu w. Drag&Drop, filelist, cmdline

Post by *dindog » 2019-10-20, 08:05 UTC

hi5 wrote:
2019-10-19, 07:38 UTC
Some thoughts:
* Perhaps AutoCAD is running as administrator (and in that case F4mm should also run as admin I think)
* Perhaps AutoCAD isn't running yet and/or the files are dropped to quickly, you can try and play with the D&D and Open delays (in milliseconds)
2.1 Drag & Drop delay gives program to start up before trying to drop the files - you may need to apply trail and error.
2.2 Open delay, pauses X ms to open next file.
Possibly: Quick search shows you're not the only one it seems with that request :) Some people use a launcher (I don't know anything about your version of course)

https://forums.autodesk.com/t5/autocad-forum/open-multiple-drawings-using-one-autocad-window-only-in-windows/td-p/3083076/page/2
https://github.com/vanowm/AutoCAD2000-2002_Launcher (perhaps use this as "editor" in F4mm)
I do a little research last night by the links you post above, and I can have drag and drop for autocad only by its main windows class by ahk_class, at least for the first files.. then I can drop with ahk_exe, weird. Anyway, it's not practicle have a global drag&drop for Autocad, because it's very hard to know how long a file cad need to load,it will vary from 0.x second to half a minute, and before the last filed was completely loaded, it won't accept new drop in.

One more things, I noticed the non-ASCII name file fail to drop, is there something of the filename string converted to before it drop to the application?

hi5
Member
Member
Posts: 179
Joined: 2012-11-03, 11:35 UTC
Contact:

Re: F4MiniMenu (AHK): F4Menu w. Drag&Drop, filelist, cmdline

Post by *hi5 » 2019-10-20, 12:20 UTC

So you might be able to produce a small launcher yourself using method 3 (filelist) and process these one by one via dropfiles ahk_class. If there is a way to see when a file has completed loading - perhaps a statusbar or checking the window title? - build in a "wait for file to be loaded" check before moving t the next.

With regards to non-ASCII name files: I don't really know why/how to fix that - when I check with some MsgBox-es I see the filenames are passed correctly from TC to F4mm to the DragDrop function but the application receives "garbage" it seems. When actually manually dragging that same file some apps accept such files, but others still can't "read" it even though the app supports drag & drop. I've tried quite a few dropfiles functions posted on the AHK forum but they all have that "error" :(
F4MiniMenu - Open selected file(s) from TC in defined editor(s) - A (minimalistic) clone of F4Menu
Source at GitHub (AutoHotkey) - TC Forum thread

dindog
Member
Member
Posts: 197
Joined: 2010-10-18, 07:41 UTC

Re: F4MiniMenu (AHK): F4Menu w. Drag&Drop, filelist, cmdline

Post by *dindog » 2019-10-20, 12:57 UTC

Yes, I had written a drag & drop wrapper for F4menu by the drop function code in F4mm, but found that the current drop function do not support non-ascii filename is frusatrated to me, cause half-of my documents filename is in Chinese. I've posted a thread in the ahk forum, hoping someone will have answer of that. I remember I'd read in somewhere that the filename should convert to UTF-8 or unicode or somethings when dropping last night. Can't find it out again... :(

dindog
Member
Member
Posts: 197
Joined: 2010-10-18, 07:41 UTC

Re: F4MiniMenu (AHK): F4Menu w. Drag&Drop, filelist, cmdline

Post by *dindog » 2019-10-28, 06:35 UTC

hi5 wrote:
2019-10-20, 12:20 UTC
So you might be able to produce a small launcher yourself using method 3 (filelist) and process these one by one via dropfiles ahk_class. If there is a way to see when a file has completed loading - perhaps a statusbar or checking the window title? - build in a "wait for file to be loaded" check before moving t the next.

With regards to non-ASCII name files: I don't really know why/how to fix that - when I check with some MsgBox-es I see the filenames are passed correctly from TC to F4mm to the DragDrop function but the application receives "garbage" it seems. When actually manually dragging that same file some apps accept such files, but others still can't "read" it even though the app supports drag & drop. I've tried quite a few dropfiles functions posted on the AHK forum but they all have that "error" :(
I've found an code snippet which supported non-ascii drag & drop. tested, worked. Sorry I didn't remember from which thread in AHK forum I found it.

Code: Select all

DropFiles( FileList, wTitle="", Ctrl="", X=0, Y=0, NCA=0 ) 
{
 characterSize := A_IsUnicode ? 2 : 1
 StringReplace, FileList, FileList, `r`n, `n , All
 VarSetCapacity( DROPFILES,20,32 ),  DROPFILES.=FileList "`n`n",  nSize:=StrLen(DROPFILES)*characterSize
 StringReplace, DROPFILES,DROPFILES, `n,`n, UseErrorLevel
 Loop %ErrorLevel%
	NumPut( 0, DROPFILES, InStr(DROPFILES,"`n",0,0)*characterSize - characterSize, A_IsUnicode ? "Short" : "Char" )

 pDP := &DROPFILES
 NumPut(20, pDP+0)
 NumPut(X, pDP+4)
 NumPut(Y, pDP+8)
 NumPut(NCA, pDP+12)
 NumPut(A_IsUnicode ? 1 : 0, pDP+16)
 hDrop := DllCall( "GlobalAlloc", UInt,0x42, UInt, nSize )
 pData := DllCall( "GlobalLock", UInt, hDrop)
 DllCall( "RtlMoveMemory", UInt,pData, UInt,pDP, UInt, nSize )
 DllCall( "GlobalUnlock", UInt,hDrop )
 PostMessage, 0x233, hDrop, 0, %Ctrl%, %wTitle% ; WM_DROPFILES := 0x233
}

hi5
Member
Member
Posts: 179
Joined: 2012-11-03, 11:35 UTC
Contact:

Re: F4MiniMenu (AHK): F4Menu w. Drag&Drop, filelist, cmdline

Post by *hi5 » 2019-11-01, 22:23 UTC

That code doesn't work correctly (at all) for me on Win 10/64bit and AutoHotkey 64bit - it does work better when I use the 32bit unicode version of AHK. Strange.
F4MiniMenu - Open selected file(s) from TC in defined editor(s) - A (minimalistic) clone of F4Menu
Source at GitHub (AutoHotkey) - TC Forum thread

dindog
Member
Member
Posts: 197
Joined: 2010-10-18, 07:41 UTC

Re: F4MiniMenu (AHK): F4Menu w. Drag&Drop, filelist, cmdline

Post by *dindog » 2019-11-02, 05:11 UTC

hi5 wrote:
2019-11-01, 22:23 UTC
That code doesn't work correctly (at all) for me on Win 10/64bit and AutoHotkey 64bit - it does work better when I use the 32bit unicode version of AHK. Strange.
I am using win10 64bit, both ahk 64 & 32 works.. I have my own D&D wrapper for F4menu now which support non-ASCII characters using the above code snippet, strange.

Post Reply