if statement and read/writeagain coll in saving clock

elburz_s's icon

Hey there,

Been working on this clock for a bit with help from others (Broc has been super helpful so far!), I feel like I'm making baby steps to having it done. It's basically a clock that saves how long you've been working on a project in Ableton as you work. Problems encountered were that having the clock just simply tick into a live.numbox or any other live.* object would write to the undo history, which wasnt good at all. So there's a coll in it's place now and I've been reading about writeagain and readgain messages going into coll, so my current attempt was to the try have a load bang that would trigger a live.numbox to send its output into an if statement which depending on whether it was 0 or anything other than 0 (if its the first time you dropped it into your session, or if you're opening a new session) would either immediately ask you to name the file and save it somewhere, or it would send a readagain to read what it saved from the session before.

I guess before anything else, can readagain and writeagain work over the closing of a session in live? Or does closing the session basically make them just send normal read and write commands when you re-open the session? If it's the latter, I'll have to think of something else entirely I'm afraid!

Max Patch
Copy patch and select New From Clipboard in Max.

Thanks

broc's icon

It's unlikely that readagain/writeagain would work across sessions.

So you probably need to store the filename in your patch and use it for read/write operations.
The filename could for example be stored in [textedit] and typed in from the user.

But finding an elegant solution seems tricky. Good luck!

elburz_s's icon

Sorry about the delay getting back to you. Sad to hear that the readagain/writeagain idea wont work. Almost wondering if having a C/C++ external that deals with either the whole saving process or just the naming process might be the best bet. Will have to read up on that. Thanks for all the help again!!

eleven_t's icon

Hey, I suggest looking into [pattr]. Activate parameter_enable attribute and it will save clock state together with your live set ;>

broc's icon

[pattr] can be used to save the clock state but it writes the clock values to the undo history.
As mentioned in the original post, this behavior is not wanted.