Home Forums General XMetaL Discussion How to use javascript timer function like setInterval Reply To: How to use javascript timer function like setInterval

Derek Read

Reply to: How to use javascript timer function like setInterval

XMetaL Author does not implement an equivalent to the setInterval() method that most web browsers support (I assume that is where you got the idea).

Perhaps you could explain what you are creating in case I can think of an alternate solution. Knowing what you are building would also allow me to put in a feature request.

The closest I can get without using any 3rd party controls is XMetaL's GoToSleep() method. You might try putting that into a loop. However, that method is modal (stops the user from doing anything and displays an hourglass icon). I'm guessing that isn't what you are looking for.

Note: setInterval() isn't defined in JScript/JavaScript/ECMAScript, it is a method attached to the “window” object in IE (and most other browsers). I only note this because *if* Microsoft was to implement setInterval() in the JScript engine (probably the scripting engine your XMetaL macro is using to run) it would then be available to XMetaL Author. In theory you might try embedding the WebBrowserControl (ActiveX version of IE) into the Resource Manager or a document to use its version of setInterval(). This would be tricky as at least part of your code would be running in the browser and might need to call over to XMetaL instantiated as COM as well. If you chose VBScript instead of JScript then the issue would be similar as there is no equivalent in VBScript. Other scripting languages that can be used with XMetaL might have an equivalent method, such as PerlScript or Python. I don't use those much though so have not checked to see if they do.