Drag and drop files onto my app

#1

I need to create a simple app that will allow me to drag .wav files onto my app’s icon so I can batch process them. I’m on a Mac.

Any ideas how to get started here?

  • Console app or GUI app?
  • How to get my app to allow files to be dropped onto it?
  • How to get the list of files that were dropped onto it?
0 Likes

#2

Did you check out the “FileDragAndDropTarget” class?
Not sure if it works with an App-Icon (i.e. minimzed application).
But I implemented this some time ago for a component inside my GUI.
I dont remember the details, but I think it was not too difficult to implement.

0 Likes

#3

The application has to be running in order for that to work, though. If the application is not yet running and needs to be started when dragging files on the application icon, the dragged in files will be in the command line arguments. (Available when the JUCEApplication::initialise method is called.)

1 Like

#4

I found this older topic on the issue although there’s not much information:

Sounds like the application’s .plist needs to permit drag-and-drop onto the application icon, which seems to be:

After that it should call JUCEApplication::anotherInstanceStarted(), but only once the app is running it seems? (reading juce_mac_MessageManager.mm line 173)

0 Likes