Parametric

 From:  Michael Gibson
8562.4 In reply to 8562.3 
Hi andras you can actually set up a script timer now if you want, you can do it by using the HTML DOM on one of the UI panels. You can do anything that's available in HTML in those UI panels and that includes setting up timers same as how it works in script on a web page.

Here's an example that inserts a label element after the File menu button on the bottom command bar, and sets a timer that's triggered every 0.5 seconds to increment and update the label:

script: /* timer demo */ var dom = moi.ui.commandBar; var filebtn = dom.document.body.getElementsByTagName('moi:CommandMenuButton')[0]; var span = dom.document.createElement('span'); span.id = 'timerlabel'; var script = dom.document.createElement('script'); script.innerText = 'window.g_counter = 0; window.setInterval( function(){ timerlabel.innerText = g_counter++; }, 500 );'; filebtn.insertAdjacentElement( 'afterEnd', span ); filebtn.insertAdjacentElement( 'afterEnd', script );

One thing to note though is that having a script run continuously like this could have very negative performance consequences if it's doing any intensive calculations.

- Michael