Permanent pressbutton counter across HDA instances, sessions and different .hips file?

   980   1   0
User Avatar
Member
900 posts
Joined: Feb. 2016
Offline
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?
User Avatar
Member
453 posts
Joined: Feb. 2013
Offline
With Python and
import os
you can check all files in a directory. Since that is your standard anyways, it seems to me that you could just analyze what is in the directory and set things up accordingly.
  • Quick Links