Author Topic: ProvideX.Script (PVXCOM)  (Read 1627 times)

0 Members and 1 Guest are viewing this topic.

John Spikowski

  • Posts: 52
ProvideX.Script (PVXCOM)
« on: November 15, 2017, 09:24:21 pm »
Six methods are available for use with ProvideX.Script:
  • Init(path) - Called before accessing any other method in the script engine in order to set the working directory for the server and perform binding to the PxPlus dll layer. The path should be set to the desired working directory or blank to indicate the current directory. (In most cases, the current directory will be the system directory.)

  • Execute(stmt) - Invoked to execute any PxPlus command statement.

  • Evaluate(expr) - Evaluates and returns the expression provided and returns its value as a variant. (It can be used as either a numeric or string.)

  • Run(prog) - Runs the specified program. This method does not return until the program ends.

  • Reset( ) - Closes all local files and clears variables (executes a BEGIN).

  • NewObject(name, params ...) - Creates a new object of the specified name and returns an object reference (see Additional Properties below).
Three properties are also associated with the interface:

Instance - Returns a unique string to identify the server during its lifetime.

State - Returns the state of the server: 0 (zero) - Uninitialized; 1 - Initialized.

Parameter - Read/write property used to access the specified PxPlus parameter.

Additional Properties

To create an object within the OLE Server, the method NewObject is used. It returns an object identifier to the ProvideX object that was created. Along with the ProvideX defined properties and methods, the OLE server adds the following properties:

Instance - Returns a unique identifier of the ProvideX.Script object that was used to create the automation object. This is important because the automation object cannot be passed to another ProvideX.Script server.

ScriptObject - Returns the parent ProvideX.Script object.

CmdHandle - Returns the ProvideX handle to which the automation object is tied.

Naming Conventions

Be aware that COM is generally data-type insensitive; i.e. it does not support the $ or % suffix. This can cause a problem when dealing with ProvideX via the OLE Server, since in ProvideX, you can have Cust_no$ and Cust_no (as two unique data variables).

To avoid this issue, the OLE Server mandates that all property references indicate the property type in the first character of the property name:

s - For string variables

n - For numeric variables

i - For integer variables

o - For object variables (required)

Code: [Select]
Cat$ becomes sCat, Dog becomes nDog , and Pig% becomes iPig.

These prefixes are only for use by programs using the OLE Server, not by the ProvideX application itself. This means that the property Cust_no$ in ProvideX would be sCust_no when referenced by the OLE Server, and the property Cust_no in PxPlus would be nCust_no, etc.

Note:  Do not use these prefixes in the property definition. Use of the o prefix allows the specification of properties and/or methods within ProvideX objects to be declared themselves as objects.

« Last Edit: November 15, 2017, 11:08:16 pm by John Spikowski »