Application Class
The Application class is the main entry point into the Statistica Object Model.
It allows access to all of the other object within the system. The Application object can be associated with a running instance of the Statistica application (e.g., a separate process), or can represent an instance of the Statistica in-process Library component.
The Library object is a separately licensed feature which allows access to the entire Statistica API in an "in-process" component; the only difference between the Application and Library versions is that the Library version is designed for use without a user interface and cannot make anything visible.
You can start a new instance of the Statistica Application by create a new object of type STATISTICA.Application, or (if you are licensed to use it) STATISTICA.Library. This is how you would do this in VBS scripting:
Set o = CreateObject("STATISTICA.Application") o.Visible = True MsgBox o.Name
The Application object is in the global space of every Statistica Macro. This means that the Application object can be referenced in any Statistica Macro using the Application global keyword; it will always return the application object in the context the Macro is running in. In fact, the Application keyword itself is optional; you can use the Application methods and properties without explicitly specifying the "Application" object. For example, the following are identical, and will display the number of currently opened Spreadsheets:
Option Base 1 Sub Main MsgBox CStr(Application.Spreadsheets.Count) MsgBox CStr(Spreadsheets.Count) End Sub
The Application object provides access to the main Statistica objects through functions which return collections of the particular objects. This includes the Spreadsheets, Graphs, Workbooks, Reports, and Macros functions. By calling the appropriate collection function from the Application object, the system returns the StaDocuments collection object for the specified object types. Using this collection object, you can iterate through all open documents, get the count of open documents, and create new documents. You can create new objects through the collection objects using the collection's Add method.
Dim oS As Spreadsheet Set oS = Application.Spreadsheets.New
The Application objects can also provide access to the top-most visible objects through the ActiveXXX functions, for instances, ActiveSpreadsheet, ActiveWorkbook, ActiveGraph, etc. The "Ex" variety of this function include active documents in Workbooks, for example, ActiveGraphEx will return a reference to the Graph within a Workbook if the Workbook is the top-most visible object and the Graph is currently active.
You access the general Spreadsheet import through the Application object; these methods will take a reference to the file being imported, allow you to specify parameters, and return a Spreadsheet object for the imported data.