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.
I want to build a custom file browser application for this, but there isn't any kind of API. It does, however, allow audio files to be dragged and dropped from the file system, which is a great start.
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 programmatically trigger a drop event on the other application, from my file browser application.
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 too low level...)
This is how far I've got:
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.
I've also done some delving in the OSX developers' docs, specifically this stuff, which describes the sequence of messages that are passed to the target application (drop destination).
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.
So, before I do...
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.
Thanks in advance!
Not tried this, but things like CGEventCreateMouseEvent
and CGEventPostToPSN
might be helpful. CGEvent.h and CGRemoteOperation.h
I'm also wondering if the target application might respond to apple events - if it does you could create apple events and send those to it which would be cleaner. I'd try running AppleScript Editor or Automator and open dictionary on the app in question to see if it has a dictionary of events that might do what you want.
luck.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With