Perfect! Thanks much. That is not currently documented in either of the dev guides.
toggle quoted messageShow quoted text
On Sat, 27 Jul 2019, James Scholes wrote:
Use the globalVars module.
globalVars.logMarkCounter = whatever
You can check if the counter is already initialised after an add-on reload with a check like:
if hasattr(globalVars, 'logMarkCounter')
Or, try to fetch the value, get an initial count if it's not already set, and store it back to globalVars all in one go:
globalVars.logMarkCounter = getattr(globalVars, 'logMarkCounter', 0)
On 27/07/2019 at 7:09 am, Luke Davis wrote:
I have an add-on under development which writes mark lines to the NVDA log, to make it easier to find sections you are looking for.
With each marker line, it includes an incrementing number. However, currently that number only persists until add-ons are reloaded, at which point it starts back at 1.
I would prefer it to only start back at 1 if NVDA itself is restarted.
I am wondering if there is a way to store the variable outside of the add-on context?
If I write it to a file, which seems like overkill, I will then have the problem of figuring out when NVDA itself has restarted, which means a new log has been opened, in which case I actually want the variable to reset.
Current code at: