I'm building a HDA that render files down to $HIP/images/ folder with a button press.
I need to generate an unique file name each time I press the button, so that no image is getting overwritten.
I would go to set an $ENV for the counter, but I need something specific for the the $HIP/images/ folder, so that:
1) If I drop another instance of the HDA, the counter would increment from the last instance where it was used
2) Would be incremental also across different .hip files (given that they are stored in the same $HIP directory)
3) Other files written to other $HIP/images2/ would start the counting from 0.
I imagine that the only solution to do this is writing a “counter.txt” in the $HIP/images/ folder that is updated at each button press, right?