[NEVERMIND] How to make my sketch receive the file dragged onto the executable?

edited June 2018 in How To...

I already found the answer to my question, just 3 seconds after posting it here. Sorry. Here's the original post:

Using Windows 10 64bit. So I exported my sketch, and I have a .exe file that starts by double-clicking. Nothing special here, I know. However, if I drag another random file in Explorer and drop it onto the .exe file, then it doesn't open - not even a window. Investigating with task manager shows that javaw.exe opens and then instantly closes right away.

From what I read, dropping a file onto a .exe simply makes Explorer run the .exe with path to the dropped file as a command line argument. But this isn't the case, or else the sketch wouldn't instantly close and I'd be able to get the received file path by reading args[0]. (args is an array of strings that contains every command line argument received)

I want to have a .exe on which I can quickly drag and drop files and which will perform my code on such files. How?

edit: After dropping the file onto the .exe 100th time out of desperacy, it actually opened and received the file as args[0]. This removes this question immediately, but I can't find the delete button(yet), and this also sparks a new question: why it didn't work previous 99 times?

Answers

Sign In or Register to comment.