Script Manager Typical Compiler Error Messages

Format of Reference Pages


The pages following this one describe the script methods available in Mira Pro Script. In this User's Guide, all functions and class methods have a reference page that describes their usage. To understand how to implement a class method in your script, you must understand the layout of the Reference Pages.

The Reference Pages are organized into the following sections: Syntax, Example, Remarks, and Related Topics, as described below. On some of the References Pages, some particular sections are intentionally omitted.

Syntax Section

The Syntax section shows how the method or data is written in your script and describes its parameters. For example, the CImage:PolyFitImage method shows all the components of the method-call syntax:

     bResult = CImage:PolyFitImage( ct, rt, bConserve=true, CRect=nil )

and here is how to understand the components of the syntax:

    bResult is the returned value. the name bResult is a dummy that should be replaced by your own variable, should you want to use the value returned by PolyFitImage. You can omit the dummy value and = sign if you do not want to use the returned value. In this case, bResult begins with the letter "b" which indicates that the return value is a boolean variable (true or false). Names are often prefixed with the letters b, n, or s to indicate that the returned value is a boolean, number, or string. This protocol is not adhered to all the time, especially when the type of value is either obvious or may actually be any of these types.

    CImage: is the name of the class that owns the PolyFitImage method. When you call a class member, like PolyFitImage, from your script you must prefix it with the name of the actual class object and not the name of the class. For example, if you created a CImage object like this: I = CImage:new(), then I is the instance of the class object that must prefix the call to PolyFitImage. Putting it together, our script would look like this: I:PolyFitImage. If a different CImage exists and is named I2, then you would call the same member for the other instance using the syntax I2:PolyFitImage.

    Within parentheses () are the parameters of the method. In the example above, the first two parameters, ct and rt, are required. The second two parameters have an = sign and a value, indicating that they are optional. The value indicates the default value that will be used if you do not provide a value for the optional parameter. For example, the PolyFitImage method has CRect=nil as an optional parameter. If the script calls PolyFitImage but does not specify a CRect object (a rectangle), then Pro Script defaults the value of CRect to nil. The next level of script processing sees the nil value even though you would have terminated the parameter list after 3 arguments.

    Often the parameter list contains a reference to another class object, like the CRect in the PolyFitImage method. For these parameters you pass the name of the reference to an instance of the class. For example, if you used R = CRect:new(1,2,100,200) to create an instance of a CRect, then you would pass R as the CRect argument shown in the Syntax (or pass nil, or just omit it as described above).

    In summary, as described above, your actual usage of this method might look like any of these:

                       bSuccess = I:PolyFitImage( 2, 3, true, R )

                       bSuccess = I:PolyFitImage( 2, 3, false )

                       bSuccess = I:PolyFitImage( 2, 3 )

                       I:PolyFitImage( 2, 3 )

Remarks Section

This section describes how the method is used and how it works or might be implemented in a script.

Example Section

This section is present on most of the description pages. It usually gives a short description of how to implement the method followed by a script fragment. In the script fragment, the line containing the actual method of interest is highlighted. Comments are included in green, like this -- this is a comment, as you would see them in the Script Editor. For the PolyFitImage example, here is what is meant by a script fragment:

I = CImage:new()

-- create a new CImage

I:Open( sPath )

-- load the image

I:PolyFitImage(7,4)

-- perform the operation on image I

I:Display()

 

I:delete()

 

Related Topics Section

The Related Topics lists links to other topics having related methods or a similar purpose.

Related Topics

Script Classes, Script Editor