Hi Moi3dFan, so for the UI part inside GeneralOptions.htm, in order for the script code to interact with
the UI controls you need to set an id="" attribute on the controls.
Also the <moi:Text> control is used to look up a text value from the current language string table.
Since there aren't any translatable strings set up for these you should just have your text directly and not any <moi:Text> elements.
So the UI part inside GeneralOptions.htm should look more like this where the <moi:NumericInput> and <moi:CheckButton> have id attributes set on them:
code:
<fieldset>
<legend>Autosave</legend>
<table>
<tr>
<td>Autosave Time:</td>
<td><moi:NumericInput id="AutosaveTimeControl" /></td>
<td><moi:CheckButton id="AutosaveIncrementalControl">Incremental</moi:CheckButton></td>
<td><moi:Spacer/></td>
<td style="font-size:75%; color:gray; margin:5px;">For correct work, the first time you
need to <br> specify a location for automatic saving</td>
</tr>
</table>
</fieldset>
So now that script code can access the numeric input and check button controls to get or set
the values they contain. This is done by setting the .value property on the control. In script
code every element on the page that has an id="" attribute set on it can be accessed through
a global variable of that name. So if you have this for the HTML part:
<moi:NumericInput
id="AutosaveTimeControl" />
Then script code can use it like:
var value =
AutosaveTimeControl.value;
So inside Initialize() the script code should go something like this:
code:
var Autosave = 18000;
var Autosaveincremental = false;
try {
Autosave = moi.command.getOption( 'Autosave', true);
} catch(e) {}
try {
AutosaveIncremental = moi.command.getOption( 'AutosaveIncremental', true);
} catch(e) {}
// Set UI controls to have the values that were just read in from moi.ini
AutosaveTimeControl.value = Autosave;
AutosaveIncrementalControl.value = AutosaveIncremental;
Then inside the Shutdown() function you can retrieve the values from the controls like this:
code:
moi.command.setOption( 'Autosave', AutosaveTimeControl.value, true);
moi.command.setOption( 'AutosaveIncremental', AutosaveIncremetnalControl.value, true);
I hope that will get you unblocked, I haven't tested the above code so there could be typos.
- Michael