23 Replies Latest reply: Feb 19, 2015 10:39 AM by Saket Kore RSS

    Run macro from server

      Is there any way to have the Enterprise Manager run a macro when reloading a QV-document? I've tried setting up running of this macro with Task Scheduler on Windows Server 2008 but I can't get it to run properly without myself being logged in. Also it requires my account to be associated with a developer-license which is also undesirable. I'd like it to just run from the server. Is this possible?

        • Run macro from server

          hi,

           

          Wat u can do is write the macro in notepad n save it as .vbs file(vbscript). Then u can write a batch file to run this file.

          Now at qmec u can include this batch file in external tasks.

           

          Hope this helps.

           

          Br,

          Prasanna.

            • Run macro from server

              Thanks for the reply.

              My macro interacts with some of the components in the QV-document (performing various selections and such things). Will this work when run as external task? Will the API for QlikView still be available for VBScript-code that runs "outside" of the QV-document?

              • Re: Run macro from server
                Saket Kore

                Hi Prasanna,

                 

                I've created a vbs script file which accesses the QV document data to format a mail body and sends a mail. The vbs works properly wen triggered via command prompt. However i tried to trigger the vbs script via a batch file using a supporting task. Though the supporting task runs successfully, it doesn't trigger the vbs. (I don't receive any mail.) Does supporting task do not support this types of operations?

                  • Re: Run macro from server
                    Peter Cammaert

                    Supporting tasks support whatever you throw at them.

                     

                    However your conclusion (not triggered because I don't get any email) may not be entirely correct. There are many possible points of failure in a black box-setup like this.

                     

                    Does your vbs script output any logging information?

                      • Re: Run macro from server
                        Saket Kore

                        Hi Peter, Thanks for the quick response.

                         

                        I tried with a different vbs script which creates a simple .txt file (This vbs script doesnt interact with the Qlikview document). And that went through successfully when triggered using Supporting task via a batch file.

                         

                        However my mailer vbs script doesnt seem to to go through successfully. (Please note this vbs script does work fine when triggered via command prompt.)

                         

                        Since the only difference between these two vbs scripts is that the latter interacts with the Qlikview document, i concluded that the supporting task doesnt not support this.

                         

                        In your opinion, should the supporting task support this operation? I'll dig in further to check if there's anything else causing the vbs operation to fail.

                          • Re: Run macro from server
                            Peter Cammaert

                            Yes it should, but that depends on how you interact with your QlikView document. If you use QV Desktop to do something with a document, remember that QV Desktop requires a license, and the service account that is running the supporting task probably has none.

                              • Re: Run macro from server
                                Saket Kore

                                I use CreateObject("QlikTech.QlikView") to create an instance of Qlikview; which i use to interact with the Qlikview document. If i'm not wrong, this refers to Qlikview Desktop, right?

                                 

                                This does make sense that the vbs is unable to interact with the QV document since the service account which has triggered the script doesnt have a license. Thanks for the pointer; it did not occur to me to consider the license.

                                 

                                I'm thinking if I execute the vbs as a different user which has a valid license (i can do this using the intermediary batch-file), this might work. Thoughts?

                                  • Re: Run macro from server
                                    Peter Cammaert

                                    No, that one refers to QlikOCX, the OCX library. Which is the QV Desktop without UI. However, it should detect a valid license too (either an OEM license, or a Named CAL)

                                     

                                    You can try the runas command to temporarily change the user when running your vbs script..

                                      • Re: Run macro from server
                                        Saket Kore

                                        I'll give it a try. Thanks a lot, Peter.

                                        • Re: Run macro from server
                                          Saket Kore

                                          Hi Peter,

                                           

                                          I checked, and the system account that triggers the supporting task on the publisher does have a user CAL. Whenever the vbs script interacts with the dashboard, it doesnt seem to execute properly (even though the supporting task executes successfully.) But when i modify the vbs script so that it doesnt interact with the dashboard, it executes properly.

                                           

                                          I tried triggering the vbs manually using the publisher system account credentials, it does execute.

                                           

                                          However when the same vbs is triggered via a publisher supporting task, it does not execute. (Please note, the supporting task does not fail. However the vbs script does not execute.)

                                           

                                          Does this mean that the supporting task does not permit executing any programs that interacts with the qlikview dashboard?