Hi Michele, for the next v5 beta I've added in a function that will flush the moi.ini file settings that are in memory out to disk as normally happens when you exit from MoI. I'll also add a function for retrieving a value from the in memory moi.ini settings.
re:
> Should I write to INI settings file? Can I do that?
Yes, a script can persist a value to moi.ini by using:
moi.command.setOption( OptionName, OptionValue, true /*To ini*/ );
It can read it back using:
var val = moi.command.getOption( OptionName, true /*From ini*/ );
If there is no value previously st then moi.command.getOption() will throw an exception so you need to put it in a try/catch block something like this:
var value = 0;
try { value = moi.command.getOption( 'optionname', true ); }
catch(e) { }
Options saved using this method will be stored in the [Commands] section of the moi.ini file.
- Michael
|