Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Execute Macro after finishing document load

Hello,

I have a QlikView document which contains an object with images and emoticons.

I developed a vbscript Macro with 3 steps :

- Select a Date value from a variable,

- Take a screenshot of the object after selection and save it as JPG file,

- Send a mail with the JPG in attachment.

1- When executing the macro with Button action, I get the wanted result : an email with the attachment and a complete screenshot :

CompleteScreen.png

2- When executing the macro with the "OnOpen" trigger, the mail is sent with attachment but the screenshot is incomplete and doesn't contain the images and emoticons :

IncompleteScreen.png

Does anyone have an idea to fix this issue ?

Thanks in advance

5 Replies
Anonymous
Not applicable
Author

Hi,

Did you tried to run the Macro on Post reload option?

-Jay

marcus_sommer

Maybe the calculations aren't finished when the screenshot was made. Try to put these statement before the screenshot:

ActiveDocument.GetApplication.WaitForidle

- Marcus

Not applicable
Author

Hi,

Thanks for your answer.

Even On Post Reload, that doesn't work !

Not applicable
Author

Hi,

Thanks for your answer.

That's the problem : the screenshot statement run before calculations.

Even ActiveDocument.GetApplication.WaitForidle or ActiveDocument.GetApplication.Sleep doesn't solve the problem.

marcus_sommer

Sleep won't help because everything is sleeping but WaitForIdle should wait for finishing the calculations. Maybe it's not directly the calculation else the rendering from gui which is working yet or the wait-statement isn't on the right place. You could post the script maybe there is what to find.

Sometimes it helped to create a virtual overhead to delay the execution maybe some loop with a calculation or further selections within the app or to run a ping-statement. But I believe it will be rather an ugly trial & error game ...

- Marcus