Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi , i have a macro that export images, when i run this in the qlikview with a button it works perfect.
When i run this with a batfile, it's reloading the qv but the last thing happend is that the macrowindows stays open and nothing more happens.
Batfile:
"C:\Program Files\QlikView\Qv.exe" /l /NoSecurity "C:\Qv\MXXX.qvw"
Macro:
function exportImages
' Test if export should be made
set v = ActiveDocument.Variables("RunNow")
if v.GetContent.String = "Yes" then
v.SetContent "No",true
exportAll
ActiveDocument.GetApplication.Quit
end if
end function
function exportAll
export("CH01")
export ("TX01")
end function
function export(chartId)
set obj = ActiveDocument.GetSheetObject(chartId)
obj.ExportBitmapToFile "C:\UTL\Chart_" & chartId & ".png"
end function
What can i do to get this working?
Br
It might be that a function couldn't quit the application - change the functions like above suggested to sub's and try it again.
- Marcus
Yes, changed and it's the same
sub exportImages
' Test if export should be made
set v = ActiveDocument.Variables("RunNow")
if v.GetContent.String = "Yes" then
v.SetContent "No",true
call exportAll
ActiveDocument.GetApplication.Quit
end if
end sub
sub exportAll
call export("CH01")
ActiveDocument.GetApplication.Sleep 1000
call export ("TX01")
end sub
sub export(chartId)
set obj = ActiveDocument.GetSheetObject(chartId)
obj.restore
ActiveDocument.GetApplication.WaitForIdle
obj.ExportBitmapToFile "C:\inetpub\wwwroot\as400\UTL\Chart_" & chartId & ".bmp"
ActiveDocument.GetApplication.Quit
end sub
For me it worked. The quit-statement should be placed in exportAll and not in export because it would quit it already after the first export.
Do you execute the batch manually or with any other task?
- Marcus
Okay,
it's seems to working just for now. It's closes.
But i noticed that mayby it's open in Running task in windows.
It shouldn't - the batch creates a new instance and QV quit it again. It should work in this way.
By testing such things you need further ensure that no other instance has opened the same file and/or that further files are opened within the instance - to avoid the classical windows popup's if you want to overwrite this file or store the other or similar things because these popup's are there but won't be displayed in any way.
- Marcus
Thanx Marcus and all others, it's finally working. Can i change bitmap to JPG or png. Bmp is bigger and it's for the web 🙂
AFAIK only bmp is available. I think you will need a third-party tool to convert them.
- Marcus
Hi! If you export the images as
obj.ExportBitmapToFile "C:\QV\Chart_" & chartId & ".png"
Then it will be saved as a PNG file (at least so happen in my PC with QV 11.2).
Regards,
Jaime.
P.S.: Glad it's been solved finally! 🙂
Hi Jaime, yes it worked with .png to 🙂 Thanx! 🙂
Hi All, must reopen this.
There is a difference between qv8.50 and qv12.
In QV 12 it halted in macro, in qv 8.50 in runs perfect.
I want a gauge that not supportet in 8.50
Any ideas?