General XMetaL Discussion
XMetaL Community Forum › General XMetaL Discussion › How to use javascript timer function like setInterval
-
swisslex February 19, 2013 at 10:04 am
How to use javascript timer function like setInterval
February 19, 2013 at 10:04 amParticipants 1Replies 2Last Activity 9 years, 11 months agoHi,
I try to set a interval to make some periodical checks.
I work with the Javascript enviroment of XMetaL.
Is there any similar available in XMetaL?
In Javascript it would look like this:
setInterval(function () { alert(“Hello”) }, 3000);Thanks for your help.
Derek Read February 19, 2013 at 11:31 pm
Reply to: How to use javascript timer function like setInterval
February 19, 2013 at 11:31 pmXMetaL 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.
swisslex February 20, 2013 at 8:01 am
Reply to: How to use javascript timer function like setInterval
February 20, 2013 at 8:01 amThanks for your answer.
We use XMetal as external editor for our production tool. You have to acquire a lock for the document you want modify. This lock must be renewed periodically.
What I would like to have is kind of a timer / interval that triggers the lock renewal.
It would be nice to have something like this. But in my case there is a workaround. I will let the production tool renew the lock.
But the solution let XMetaL take care of that would have been a cleaner solution. -
AuthorPosts
- You must be logged in to reply to this topic.