Note that there are some explanatory texts on larger screens.

plurals
  1. POTrigger drop event on another application in OSX
    primarykey
    data
    text
    <p>I use a bit of proprietary software for DJing (Native Instruments Traktor). If you're not familiar with this kind of thing, just think of it as a glorified iTunes: it browses and plays audio files.</p> <p>I want to build a custom file browser application for this, but there isn't any kind of API. It <em>does</em>, however, allow audio files to be dragged and dropped from the file system, which is a great start.</p> <p>The nature of the file browser I'm designing means I don't want to actually have to drag and drop things - I just want to click a component in my application, and have the same effect. So I'm looking at ways to <em>programmatically trigger</em> a drop event on the other application, from my file browser application.</p> <p>My platform of choice is Python with PyQt, but I'm beginning to feel I might have to go a bit lower-level. Haven't done a huge amount of C#/Java though so that could be a bit of a learning curve (I have done a lot of ANSI C but that's probably <em>too</em> low level...)</p> <p>This is how far I've got:</p> <ul> <li>I've made a really simple PyQt application</li> <li>I can create QDrag object when a QLabel in my application is dragged</li> <li>I can attach all the correct MIME data to represent the audio file to this</li> <li>So if I drag and drop that QLabel from my application into Traktor, it recognises the audio file and plays it - good times</li> </ul> <p>So now I need to cut out the middle-man and, on click, package up my MIME data and make Traktor think I've dragged and dropped it onto it.</p> <p>I've also done some delving in the OSX developers' docs, specifically <a href="https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/DragandDrop/Concepts/dragdestination.html">this stuff</a>, which describes the sequence of messages that are passed to the target application (drop destination).</p> <p>This all makes sense, but I'm on the verge of dropping down to C#/Java to try and mimic these messages, which sounds like rabbit hole I'd rather not venture down if I can avoid it.</p> <p>So, before I do...</p> <ol> <li>Is this even possible? Or am I going to hit some kind of cross-app security barriers etc? (drop destinations only accepting messages directly from the OS or something)</li> <li>If it is, is there an easier way to do it? Ideally with PyQt/Tkinter/wxPython...?</li> </ol> <p>I know I could do this with click automation, but I can imagine that being really unreliable, would be massively reliant on the positions of windows, etc.</p> <p>Thanks in advance!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload