Updating desklets automatically

Hi all,

just moved over to avedesk last week. Great prog. with lots of potential.

I'm just wondering how I get my desklets to update automatically - e.g. on startup. For example my weather desklet (AH's weather) doesn't automatically update data on start - I have to do it manually.

Any help much appreciated,

Garcia.

#386642

Ok, I figured out how to update AH's weather desklet on startup. I just added a few lines to the function CreateSetup() in main.js:

function CreateSetup()

{

var IsSmallMode = this.parameters.item('SMALLMODE').value=='1';

if (IsSmallMode)

{

SlideDown();

this.ForceXDataFetch();

SlideUp();

}

else this.ForceXDataFetch();

UpdateLayerPos();

SetSun();

}

Basically it checks to see if it is in small mode. If so it slides down first before updating, then slides back up. The reason for this is that the updating depends on whether the desklet is in small mode or large mode. In large mode everything gets updated (including the 5 day forecast), so we prefer to be in large mode to update.

Ok so problem solved. Except I noticed that most of the time the slide down slide up happens too quickly to be displayed. And on the odd occasion it happens slow enough to be visible, it actually looks really nice.

So now the problem is how do I get a delay in there?

I've been trying to use the setTimeout javascript function:

setTimeout ("SlideUp()", 3000);

which is supposed to wait 3000 miliseconds (=3 seconds) before executing the command SlideUp(). But this plain doesn't work. I've tried removing the quotation marks, using single quotation marks, using all ranges of numbers (0,1,10,100,100,10000000 etc.) but nothing works.

Help!

:confused:

Garcia.

#387258

setTimeout() is not part of the ECMA-script standard iirc, so it's only implemented in browsers. Use AveScripters own this.Timers.New() timer thingy

#387261

Thanks Andreas,

I'll take my next question to the avescripter forum ... i.e. how do you use that function.

Many thanks,

Garcia.

#387264