"Open with" -> (program name here)?

edited March 2014 in How To...

I have been thinking about making a simple audio player that can open and play sound files using minim with a cool interactive graphic interface that flows with the music. I wanted to know if there is at all a way to take in command line parameters, and if so, if it is possible to set up a system to where a user can right-click on an audio file - "open with program" - (program name) for a processing application, so that the program would read the file and load it into my audio player. Thanks in advance.imgres

Answers

  • What you're looking for is called a filetype association. It's doable, but it'll take more than the basic Processing IDE.

  • So.. I did some research on file-type association after a while. I am very happy to say that this is very possible in processing and a bit of registry editing. I first made my sketch take in command line arguments... with file type association the first command-line argument specifies the path of the file to open with (either by file type association, open-with, or dragging a file onto the program). To grab this value I did this:

    String fileName = args[1];

    I used this file name with the "open()" command to read the specified text file data. After I was done with the sketch, I exported the program. Next, I used regedit.exe to create registry keys for my program. A simple Google on filetype association with regedit will show you the way. I made up my own custom file-extension and now whenever I double click one of my .cmap files, my program opens it up.

    Thanks Kevin for the pointer!

  • edited August 2014

    Forgot to mention that this is completely irrelevant for mac computers.

Sign In or Register to comment.