Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
 
					
				
		
 johnan
		
			johnan
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		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
 
					
				
		
 johnan
		
			johnan
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		I try to open manually (without batfile) and reload and it's open the macrowindow here to.
Something wrong here?
 
					
				
		
 marcus_sommer
		
			marcus_sommer
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		The most practicable way to find the issue is usually to check the code partly, for example by commenting some routines or parts of them, adding some msgbox to show until when the routine runs and which values certain variables have and also setting some variables/parameter differently.
In your case I would set the UI variable to "No" and check and then adding msgbox's (with 1,2,3, ...) below/above the sub-statements to track when it breaks.
In your case I could imagine that the button is within the sheet of the charts - but if the application is saved within another sheet as active-sheet your routine might need an extra-statement to go to wanted sheet and activate it.
- Marcus
 
					
				
		
 johnan
		
			johnan
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Okay, can i mail the application?
 
					
				
		
 jaibau1993
		
			jaibau1993
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Marcus is right: you can force the problem by reloading your app so add breakpoints to your code (exit sub and msgbox) so you can check where exactly is the problem.
Let us know!
Jaime.
(can you share an example app that reproduces the problem?)
 
					
				
		
 rwunderlich
		
			rwunderlich
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		How are you triggering the macro from the batch reload? A trigger? Which one?
-Rob
 
					
				
		
 johnan
		
			johnan
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hi Rob,
Not in the batchfile at all.
The batfile contains:
"C:\Program Files\QlikView\Qv.exe" /l /NoSecurity "C:\Qv\Man2Bild.qvw"
And then i have a trigger in qv-app that should run after script execution.
 
					
				
		
 johnan
		
			johnan
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Here you go!
I't seems to work manually, but with batfile itt just want to open macrowindow after reload
the batfile (can't attach)
"C:\Program Files\QlikView\Qv.exe" /l /NoSecurity "C:\Qv\emtpy.qvw"
 
					
				
		
 jaibau1993
		
			jaibau1993
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Works perfectly (manually and from bat) in my PC and I have only changed the path where images are saved.
Let's see if Marcus or Rob figure it out! May be it is because the QV version, Operative System, environment (are you running the QV file and the bat file inlocal machine, in a server,...?)...
Regards,
Jaime.
 
					
				
		
 marcus_sommer
		
			marcus_sommer
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Agree, worked without any issue per button and per external batch. Take a look in the document- and your user-properties in tab security if all settings are set properly.
- Marcus
 
					
				
		
 johnan
		
			johnan
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		This is mine:
Version QlikView 12.20
