11-14-2020 03:36 PM
Hello,
I am trying to create a timestamped file (to prevent overwriting files) each time a button is clicked. I only want a new file to get generated when "Save data" changes from False to True and not when it changes from True to False. Once the file is generated, I want to continuously write to the file until the button is clicked again (Save data = False). I've attached an example of what I'm trying to do but can't get the path to update correctly. I've tried sending the updated path via a notifier but there is an error running the program because the path doesn't exist yet.
Does anyone have advice on how to do this? Any help is greatly appreciated.
11-14-2020 07:50 PM
I suggest you start looking into a Queued Message Handler architecture. It is similar to a Producer/Consumer, but it sends commands instead of raw data. One of the commands should be "Start Record", which tells the QMH to create a new file and set a flag to save the data. Another command can be "Stop Record", which closes the file and clears the record flag. Finally, there should be a "Close" command telling the QMH to close all of its references and stop. My trick is to use the queue's timeout to perform the repeated action.