Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
All, I am trying to figure out if anyone has had any luck creating a BATCH file that is called up in publisher via the external task option.
I would love to know what BATCH file could be writen to open a document and than run a MACRO?
Or can a post reload MACRO work in publisher? Any or all suggestions would be welcomed.
The ulimate goal would be to send an email of a JPEG for each value in a FIELD...
Yes, I run external tasks that open QV documents. Here's an example of my external command.
psexec -x cscript D:\qlikviewTools\cmd\safetyExport.vbs
The vbs script opens a QV document and exports some sheets to jpg files.
The tricky part is that to open a QV document, you have to have GUI desktop. Publisher runs as a service and services don't have a desktop. As a workaround, I use the psexec utility (http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx) "-x" switch which means "run in the Winlogon desktop".
The downside to running in the Winlogon desktop is:
1. Only one of these process can run at a time.
2. If your script or QV session has an error that presents a modal dialog (like an error popup), the desktop is blocked until someone actually dismisses the dialog. This means that something like an hourly run will fail if the previous run leaves an unresolved dialog.
I keep looking for something like a "virtual desktop" where I can launch these processes and then destroy the desktop after a timeout. Or better yet, a "headless" version of QV that still allows for exporting graphic objects.
-Rob
Rob do you have an exapmple of your script?
I was going to set up a BATCH job
"C:\Program Files\QlikView\qv.exe" /l /NoSecurity "X:\QlikView Storage\Applications\test.qvw"
That would be called up on Publisher and then I would use "Create External Command Task"
That would call up that BATCH job wich I have a QVW that is juts a BINARY load that would than send out my Email using a MACRO on PostReload
I find it easier to put all the code in an external file instead of a macro in document. Makes it easier to do things like close the document and quit QV. Attached is the VBS code for the example I discussed.
-Rob
Rob, 2 quick questions
1, can you turn off thje prompts?
2 'Call ExportSheet(docObj, "SH10", "Safety_Recent") doesn this ask on sheet Saftey_Recent export sheet object SH10?
In normal operation, there are no prompts to the UI. If an error occurs, that may cause an error popup. Supposedly, my use of OpenDocEx is supposed to prevent error messages from appearing, but it's never worked the way I expect it to.
On your question #2, I'm not understanding your question. The Call... calls the ExportSheet Sub. The Sub exports the sheet named "SH10" to a file named Safety_Recent.jpg. It uses the API function ExportBitmapoToFile and there is no user dialog involved. Does that answer your question?
-Rob
I have to click OK on Windows Script Host, in otrder for it to pen up the QVW... Is that correct?
Many thanks
No, I have not needed to respond to open the QVW. What's the text of the prompt?
Are you running your vbs file with cscript (not wscript or default)?
-Rob
Opening with Windows Based Script Host
You are running your vbs file with wscript. In wscript, Echo messages are output to dialog boxes. You have to click OK for every dialog box.
The message you are seeing is from the code Wscript.Echo...
Run your script with cscript instead to get a command line window like in the original example:
cscript myscript.vbs
-Rob