We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I found a way to tell processing to save a file with a name. Yet that means every time I run that function, it overrides the image I saved previously.
So (and I don't know why this is so hard to find on the internet) is there a way to have a 'Save As...' box pull up instead where I can name the file myself?
Answers
Check this
https://processing.org/reference/selectOutput_.html
or this
https://forum.processing.org/two/search?Search=selectoutput
Kf
Hello
Check this
https://processing.org/discourse/beta/num_1274792797.html
It loops, because I have to have this run when the user clicks a button, a button that is in draw(). When I put noLoop() on the line after it, it doesn't save the file and my program won't let me do anything else.
I really wish they would come up with an easier way to separate looping and nonlooping content.
Here is an example modified from a previous discussion:
Kf
I"ll try that later, but it seems like a lot of code. I can run this on clicking a specific button I made and not have it loop?
@GoToLopp I should have checked it before trying the thread...
Kf
?
Did you read the references?
In any case, read this also - FileDialog, and perhaps quite importantly, even this - FilenameFilter.
The function selectOutput() already does what you want. In my previous example, replace the following relevant function:
There is no need to initiate a new thread as the selectOutput() function does that for you. If you run my example, you will see that draw keeps running even while you are in the process of selecting your output file.
Kf
@kfrajer You're kind of talking to yourself.....
First, you initiate a new thread in your code when it is not required. The you're explaining that it is not required. And can I ask you one last question - why do you always use mouseReleased() instead of mousePressed()?
There's also mouseClicked(), which is mousePressed() + mouseReleased(): ;;)
https://Processing.org/reference/mouseClicked_.html
That's not really very useful, is it? What's the point of it?
OK, I'm confused at this point. Let me explain that I have opening a file working fine already. All I need it to save a file. I don't want the save file dialogue box to pop up automatically, only if someone clicks a save button.
So your question is actually "I want to program a button that launches selectOutput() when it's clicked"?
That asks for a string. I want a save as box to pop up where the user types in a name and chooses location to save just like a typical save as... function that other programs have.
This loops nonstop so I get save as... windows loading in an everending stack. If I put in noLoop() it works but doesn't actually save a file.
https://forum.Processing.org/two/discussion/16097/launch-won-t-work-inside-selectinput-function#Item_3