We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello,
Which could be a way to export a new pdf file with an incremental number every time I open the sketch or run the code? Thank you
`int maxImage = 2; PImage[] imgs = new PImage[maxImage]; float x = 0; float y = 0; int imageIndex = 0;
size(595,842);
beginRecord(PDF, "test00.pdf"); background(0);
for(int counter = 0; counter < 5; counter++){
for(int i = 0; i < imgs.length; i++){
imgs[i] = loadImage(i + ".png");
image(imgs[imageIndex], x + 150, y + 150);
imageIndex = (imageIndex +1) % imgs.length;
x += random(0, 50);
}
}
endRecord(); println("End");`
Answers
https://forum.Processing.org/two/discussion/15473/readme-how-to-format-code-and-text https://forum.Processing.org/two/discussion/4275/how-to-compile-a-series-of-functions-into-one-variable
thank you, but...
how can I increment the file name by one each time?
I am thinking it could be a variable that store the file name (eg. "test00.pdf") and when I run or open again the sketch it remember the last name and write a new one (test01.pdf)...
Thank you
Does it have to be 01, 02...? Because using timestamps would ensure distinct names
Test-20160305-113405.pdf
Etc
That way you wouldn't have to store the current index.
You can check if a file exists to find the last file created.
https://processing.org/discourse/beta/num_1196028323.html