Working autosave, but need help to finalize it

 From:  Michael Gibson
11150.2 In reply to 11150.1 
Hi Moi3dFan,

re:
> And here are the parameters that I would like the autosafe to take from moi.ini

When a script calls moi.command.getOption( 'optionName', true /* fromIni */ ), the option will be stored in the [commands] section of the moi.ini file.

To initialize your controls you could add some code to the Initialize() function that is inside GeneralOptions.htm. Give the controls an id="" value so they can be addressed by the script code.

Something like this:

var Autosave = 18000;

try {
// Be prepared for moi.command.getOption() to throw an exception if the setting is not present.
Autosave = moi.command.getOption( 'Autosave', true /* fromIni */ );
} catch(e) {}

control_id.value = Autosave;


And to persist it, add this to the Shutdown() function:


moi.command.setOption( 'Autosave', control_id.value, true /* true = save to ini */ );


- Michael