hi!
i'm trying to make a sketch that can open files via open with.
i want to use this for my COMP sketch (collection of parts eg. name1>name2,name3).
can anyone help me?
thanks in advance.
Going back to your previous post, it is not clear what you want to do. I suggest you provide some code showing your attempt. What do you mean with remotely?
Dunno whether there's such library for Java. You'd have to look that up. I-)
But your 2nd best option is Processing's library Drop: :-bd http://Transfluxus.GitHub.io/drop/
That wouldn't be any library to do that. Depending on the OS, there are different ways to do that. I've tried many times, but it just wouldn't work on Windows 8.1. In Windows, AFAIK, there are registery keys or something like that which handles which extensions are opened by which programs. Unfortunately, it doesn't seem to be working with any of the .exe files exported by Processing, or even any .jar files I have made. I believe that it is some problem within Windows 8.1 because I can get it to work with something like start sketchname.exe - "img.jpg", the String "img.jpg" is forwarded to the Processing sketch (you can access arguments passed in using args array of Strings available inside setup).
This sounds like a macOS / Finder question. Once you have exported a processing sketch in app format, You can configure the app package contents to register itself for certain file types:
Answers
Use selectInput().
https://processing.org/reference/selectInput_.html
Kf
@kfrajer I linked the page myself.
Great! I didn't notice. My bad.
Kf
i mean that you right click a file somewhere and do open with>your sketch and that it can handle that remotely
Going back to your previous post, it is not clear what you want to do. I suggest you provide some code showing your attempt. What do you mean with remotely?
Kf
i want to right click a file, then do open with...>your sketch and do something like:
void onOpenWith(String filePath) { //load the file }
i don't have code yet, and i know how selectInput works also, i want it to work in the export
Dunno whether there's such library for Java. You'd have to look that up. I-)
But your 2nd best option is Processing's library Drop: :-bd
http://Transfluxus.GitHub.io/drop/
it is useful, but it doesn't handle file>open with...>sketch
That wouldn't be any library to do that. Depending on the OS, there are different ways to do that. I've tried many times, but it just wouldn't work on Windows 8.1. In Windows, AFAIK, there are registery keys or something like that which handles which extensions are opened by which programs. Unfortunately, it doesn't seem to be working with any of the .exe files exported by Processing, or even any .jar files I have made. I believe that it is some problem within Windows 8.1 because I can get it to work with something like
start sketchname.exe - "img.jpg"
, the String "img.jpg" is forwarded to the Processing sketch (you can access arguments passed in using args array of Strings available inside setup).https://forum.Processing.org/two/discussion/6457/how-to-use-arguments-with-an-application-built-with-processing
Apparently, according to that discussion, if I create a shortcut it will work.
That discussion has a lot more information than this, so I vote that we shift to that and close this in order to prevent duplicated efforts.
i'll try doing that EDIT: i tried, but it just won't work for me
Not even the shortcut method? I don't remember if it works for me, I'll check and tell you.
You might wanna look at this - http://www.rgagnon.com/javadetails/java-0592.html
nop. im developing on mac so that won't work for me.
This sounds like a macOS / Finder question. Once you have exported a processing sketch in app format, You can configure the app package contents to register itself for certain file types:
https://apple.stackexchange.com/questions/15030/how-can-i-add-a-new-application-to-the-open-with-menu
too bad my laptop broke, so i cant implement it
This could be relevant to open with...>your sketch for Windows users
https://github.com/processing/processing/blob/master/app/src/processing/app/platform/WindowsPlatform.java#L136
Kf
Keyword: kf_keyword open-with MME file-association associate-file
yes, but how does the sketch find out wich file to open?