View Single Post
Old 12-30-2018, 05:08 PM   #1
Human being with feelings
Join Date: Apr 2014
Posts: 3,019
Default SetProjExtState when quitting Reaper.


I guess this is a bug - as it doesn't really make any sense to work this way.

When you have a deferred script running when you close Reaper - and choose the save option on the dialog that pops up (if the project is dirty) - the quit routine runs ok for the running script - but any changes made in the quit routine to the project ext state do not save with the project. I'm assuming the project is perhaps saved before the quit routine for the script is run.

I would guess this is not preferred behaviour? If a script is set to write data to the project external state when the script is quit - then I'd assume this should happen - and it gets saved with the project. This doesn't happen in the circumstance I described above.

It works fine if you manually close the script (not whilst quitting Reaper) - the project ext state data is written to the project file fine in this case.

The problem I have with this is that my script's data is saved in a separate datafile - but I use the project state to store the filename of the datafile. However - when Reaper is quit whilst the script is still running - the script writes the data to the datafile ok - but then tries to store the latest datafile name in project ext state - but it doesn't get saved with the project - so when reloading the script - it loads an old datafile instead.

I cannot find a work around for this problem.

I have tested this behaviour with a dedicated script - which simply writes a known random number into the project state and an external file when the script quits. The external file always shows the latest random number when I quit Reaper with the script running - but the project ext state always shows an older number - never the last one.

Any thoughts?


Win10 64bit - Reaper 64bit - testing latest dev release - but as far as I know - it has been working this way since forever.
Projects - Reascripts - Lua:
LBX Stripper | LBX Chaos Engine | LBX Floating FX Positioner | LBX SRD Smart Knobs
Donate via Paypal
lb0 is offline   Reply With Quote