AutoIT – using the QlikView COM Interface

Once you get your data source loaded in QV. For example a SharePoint data source.

You can use AutoIT to interact with the QV Client COM interface.

Look for the QV Automation Interface Reference Guide for more information.

image

Example :

$oMyError = ObjEvent("AutoIt.Error","MyErrFunc")

$Qview = ObjCreate("QlikTech.QlikView")

if IsObj($Qview) Then
	MsgBox(0,"",$Qview.OSName & " " &$Qview.OSVersion)
Else
	MsgBox(0,"","NOK")

EndIf


$Qview.MsgBox("QlikView Messagebox Qv_Version " & $Qview.QvVersion )

$Qview.OpenDoc("C:\_\QlikView\Sales.qvw")

WinSetState("QlikView", "", @SW_MAXIMIZE)

$ActiveDoc = $Qview.ActiveDocument

; INSERT HERE and start every call with "QvDoc."

$Sheet = $ActiveDoc.ActivateSheet("DataSheet")

$Sheet.FitZoomToWindow

ConsoleWrite($ActiveDoc.GetVariable("vCurrentYear") & @CRLF)
ConsoleWrite($ActiveDoc.GetPathName & @CRLF)

;$Qview.Quit


Func MyErrFunc()
  $HexNumber=hex($oMyError.number,8)
  Msgbox(0,"COM Test","We intercepted a COM Error !"       & @CRLF  & @CRLF & _
			 "err.description is: "    & @TAB & $oMyError.description    & @CRLF & _
			 "err.windescription:"     & @TAB & $oMyError.windescription & @CRLF & _
			 "err.number is: "         & @TAB & $HexNumber              & @CRLF & _
			 "err.lastdllerror is: "   & @TAB & $oMyError.lastdllerror   & @CRLF & _
			 "err.scriptline is: "     & @TAB & $oMyError.scriptline     & @CRLF & _
			 "err.source is: "         & @TAB & $oMyError.source         & @CRLF & _
			 "err.helpfile is: "       & @TAB & $oMyError.helpfile       & @CRLF & _
			 "err.helpcontext is: "    & @TAB & $oMyError.helpcontext _
			)
  SetError(1)  ; to check for after this function returns
Endfunc

This example will open the Client. Show some version information and some other tricks.

And then open a specific Sheet in the QV document.

image
image
image
Of course you could also read data from the sheet and reuse this in your AutoIT application.
On top of this the QV Client supports VBScripts and JScript as a macro language.
How great is this all ! Surprised smile
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: