Cheers guys, in the end I opted (maybe a bad idea) for not getting the data
from the prefs until the timer is called (by which time it has loaded) -
Can't set the interval but I can reset the timer every time it runs with
the value from the pref - Not sure if it's most sensible but it works!!

    Application.EventInfos( "Analog_AutoBack_Timer" ).Reset( oSaveInterval,
0 )



Simon Reeves
London, UK
*[email protected] <[email protected]>*
*www.simonreeves.com <http://www.simonreeves.com>*
*www.analogstudio.co.uk <http://www.analogstudio.co.uk>*


On 12 February 2014 18:00, Stephen Blair <[email protected]> wrote:

> If you go with a custom preference, then you do something like this in an
> OnStartup event:
>
>    var xsiPrefs = Application.Preferences;
>    var renderPrefs = xsiPrefs.Categories("Acme Render");
>    // Custom preferences were not installed
>    if (renderPrefs == null)
>    {
>      var sceneRoot = Dictionary.GetObject("Scene_Root", false);
>      var customProperty = sceneRoot.AddProperty("AcmeRenderPreferences",
> false, "AcmeRenderPreferences");
>      InstallCustomPreferences(customProperty, "Acme Render");
>    }
>    else
>       RefreshCustomPreferences();
>
>
>
> On Wed, Feb 12, 2014 at 12:52 PM, Eric Thivierge 
> <[email protected]>wrote:
>
>> I've stored these types of prefs in an xml file in the user directory and
>> read / write to it as needed. I do the same with the Species preferences as
>> I cannot rely on the built in custom preferences or want to deal with the
>> baggage they bring along. My recommendation is to go that route.
>>
>> Eric T.
>>
>> On Wednesday, February 12, 2014 12:25:25 PM, Simon Reeves wrote:
>>
>>> I've not used custom preferences before but they look handy so I've
>>> given it a go.
>>>
>>> I have a plugin which is a timer event, and I want to set the interval
>>> from a value in a custom preferences property that I have created
>>>
>>> But on startup I get this error in my plugin
>>>
>>> /*# ERROR : Traceback (most recent call last):*/
>>> /*#   File "<Script Block 2>", line 14, in <module>*/
>>> /*#     oSaveInterval = (oAnalogPrefs.AutobackInterval.value) * 60000*/
>>> /*# AttributeError: 'NoneType' object has no attribute
>>> 'AutobackInterval'*/
>>>
>>> That error being this line:
>>> /*oAnalogPrefs = Application.Preferences.Categories('Analog')*/
>>>
>>> It can't find the custom pref, if I run those lines of code to get the
>>> value, or just reload (update) all plugins then it finds it and it all
>>> carries on fine - so this makes me think that soft loads the PLUGIN
>>> first, then the custom pref?
>>>
>>> Any ideas?
>>>
>>>
>>>
>>>
>>> Simon Reeves
>>> London, UK
>>> /[email protected] <mailto:[email protected]>/
>>> /www.simonreeves.com <http://www.simonreeves.com>/
>>> /www.analogstudio.co.uk <http://www.analogstudio.co.uk>//
>>> /
>>>
>>
>>
>

Reply via email to