I'm looking for a way to make the WaitForIdle (or equivalent function, even a custom one) work on a JScript macro.
What I'm trying to achieve is to pause the application (not make it "sleep", as I've already done with custom code) in order to select a value on a field and give time to the application to "update the layout" with the selection before taking a screenshot.
Currently with the lone sleep the screenshot is taken before I can see the layout update.
Do you have any hint about how to do this in JScript?
Sorry for the very late answer, I had literally no time
Anyway, this is what I discovered:
Upgrading to QlikView 11.20 SR13 the actions are executed in the right order (so they truely wait till the end of the previous action). Anyway this solved my problem only partially, because from batch the macro wasn't working properly once again. Calling the right way the WaitForIdle (see below) solved my problem Side note: at the time I wrote the question I was trying the macro with QlikView 11.20 SR7 and SR12.
The right way to call the WaitForIdle is this: Application.WaitForIdle(). My mistake was trying to call it using the ActiveDocument...
Tried that, but including it in the module gave me many errors: on the WinJS base/ui file there are many strings that ends with a ",", which I'm not sure about... Of course the parser gives me error, and I think they are wrong too... but I hope they left them there for a purpose
Still no luck with setTimeout, but thanks for trying
Let's see if anybody else has an idea/workaround for my problem
I've tried it and it works, but I don't think this example is the best one... When you use a MsgBox or something else where you need the user to execute an action (in this situation click the "ok" button to proceed with the execution of the macro) you stop the execution, so it's not like having it scheduled...
Anyway I found the solution to my problem, I'll post it later