QPR Knowledge Base 2014.1

QPR Scripting

QPR Scripting

Previous topic Next topic  

QPR Scripting

Previous topic Next topic JavaScript is required for the print function  

QPR Scripting enables easy access to the QPR API commands. Scripts are programs written in VBScript (Visual Basic) that can handle typical automated model administration tasks or integrate QPR Products with other applications. QPR Scripting utilizes standard Microsoft Windows Scripting capabilities with the addition of the QPR Application Object Model.


In the case you are not familiar with Visual Basic Scripting (VBScript), please see the language reference and User's Guide at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/vtoriVBScript.asp.


Scripts are extremely useful for automating certain model operations. You can, for example, define an XML export to be performed silently (i.e. no user interface is displayed) at a certain time, after which the data can be used in a third party tool. You can also create and update QPR Metrics models by using scripts.


When writing scripts for QPR products, the scripts must have <QPR_SCRIPT_FILE> as the very first line (header) of the file without any kinds of lines (including blank ones) preceding the QPR script header line. There are different options that can be added to the script header. See the Script Header Settings chapter for more information about the different settings. The scripts must be saved as *.qprmsc (QPR Metrics) and *.qprpsc (QPR Modeling Client) files.


To have the name and description of the script displayed in the Run Script menus in QPR Metrics client and QPR Modeling Client, use the following tags in the beginning of the script:

<NAME Name for the script>

<DESCRIPTION Description for the script>

The name and the description may not contain the '<' or '>' characters.


The scripts must always contain a "Sub Main" procedure, from which the script's execution is started. Both xxAplication and xxModel objects are initialized for scripts automatically.


The following chapters provide you with example scripts that you can use as a basis when building your own scripts. You can also find some example scripts in Appendix A.