简体   繁体   中英

how to make an AHK script to drag and drop the current playing file from winamp into another program?

I'm trying to write a script that drops the current playing file from Winamp into Tabbles (a file tagging software http://tabbles.net ) I found this example but it didn't help much: http://www.autohotkey.com/board/topic/41467-make-ahk-drop-files-into-other-applications/

How do you generate a file drop event (like 'drag and drop' without dragging though) in a program, if you have the file path? Thank you.

If you wish to emulate a drag and drop action without actually performing a MouseClickDrag you can use the following code:

; Drop test.txt into an *existing* notepad window
; Modify the class to match Tabbles window class
PostMessage, 0x233, HDrop("C:\test.txt"), 0,, ahk_class Notepad

HDrop(fnames,x=0,y=0) { 
   fns:=RegExReplace(fnames,"\n$") 
   fns:=RegExReplace(fns,"^\n") 
   hDrop:=DllCall("GlobalAlloc","UInt",0x42,"UPtr",20+StrLen(fns)+2) 
   p:=DllCall("GlobalLock","UPtr",hDrop) 
   NumPut(20, p+0)  ;offset 
   NumPut(x,  p+4)  ;pt.x 
   NumPut(y,  p+8)  ;pt.y 
   NumPut(0,  p+12) ;fNC 
   NumPut(0,  p+16) ;fWide 
   p2:=p+20 
   Loop,Parse,fns,`n,`r 
   { 
      DllCall("RtlMoveMemory","UPtr",p2,"AStr",A_LoopField,"UPtr",StrLen(A_LoopField)) 
      p2+=StrLen(A_LoopField)+1 
   } 
   DllCall("GlobalUnlock","UPtr",hDrop) 
   Return hDrop 
}

Tested in AHK_L. Let me know if this helped!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM