Layout of function Help Pages

Each OpusScript function has its own page that is split into sections. The sections are:

Syntax

    1. The Syntax section shows the function name and the case in which it should be typed e.g. GetLineCount(). You must type the name of the function without spaces between the words and with the round brackets.

    2. Some round brackets contain parameters e.g. SetColour(Colour), in which case a parameter section will also appear on the help page for the function – see Parameters below for more information.

Note:
When you type a script in the Script Action or Script Object, Opus will automatically correct the case of the OpusScript functions for you. Also, a tooltip will appear beside the name of the function showing a brief description of the function and the parameters required.

Return

  1. This section will only appear on a help page if the function returns information to the user e.g. IsAutonarratePlaying().

  2. The Return Value will describe the type of information that is sent back when this function is executed. The return may be a number, a Boolean value, a string or a new object. Make sure you understand if the function is returning information and what type of information it returns. Often you will be using the return information to perform other functions within your script.

Example:

var textPlaying = IntroText.IsAutonarratePlaying()
if (textPlaying == true)

{
 ImageIntro.Show()
}

  1. As in the example above, if you get a Return Value, you must use the function inside a variable. In the example above, the variable textPlaying contains the return value for the IsAutonarratePlaying function. The if function then uses the value in textPlaying to show an image only if the Autonarration is playing.

  2. If a function starts with the word Is (e.g. IsAutonarratePlaying, IsObjectIntersecting and IsEnabled) then you will get a return value – this will most likely be a Boolean value i.e. true or false.

  3. All of the functions beginning with Get (e.g. GetWidth and GetPosition) will return a value. So make sure you assign these functions to a variable, like the example above.

  4. Some of the functions that begin with Get (e.g. GetAppearance and GetSelectionStyle) will return a new object. These objects have their own properties that you can use.

  5. Nearly all of the Math and Date functions will return a value.

  6. Some other functions will return a value as well – these are always indicated on the help page for the function.

Parameters

  1. Each parameter in a function is given a description in the Parameters section. This indicates what type of information is required for the parameter, such as a string, a pathname or a number.

  2. If a function contains more than one parameter, each parameter is separated by a comma. You must enter the parameters in the order they appear in the Syntax section. For example, SetSelection has two parameters, start and end you must enter the value for start first followed by a comma and then by the second value.

  3. Each parameter description tells you if the parameter is required or optional. If it is required, you must include a value in the function. If it is optional you do not have to give a value.

  4. Some parameters have a default value, this means that a value will be used if you do not enter your own value. If a parameter is required but has a default value, you do not have to enter the value. However, if you have several parameters in a function each with a default and you want to change only one of the values (for example the third parameter) you must include any preceding parameters; even if you simply use the default values.

Example:

If a hypothetical function:

ExampleFunction( A, B, C )

takes A (a number, default 10), B (a boolean, default false ) and C (a string, default "bob"); then to call the function with these defaults simply write:

ExampleFunction()

If you want to override the value for C then you must specify A and B first, even if you use the default values:

ExampleFunction( 10, false, "fred" )

Simply entering

ExampleFunction( "fred" )

will not work. The string "fred" will be interpreted as parameter A and given the valueOf of "fred" – the remaining parameters B and C will be given their default values.

Remarks

  1. This is a brief description of the task the function will perform. This may also include other information, such as related functions or if another function must be used before you can use your function.

Examples:

  1. The examples link at the bottom of the page will show at least one line of code for each function and sometimes a full section of code to put the function in context.

  2. The examples show the correct syntax for referencing a function (i.e. making sure it works). If there are any errors, please do not hesitate to contact us at support@digitalworkshop.com.

  3. You should be able to cut and paste these functions into your own Script Object or Script Action. However, if the script uses objects that either don’t appear on your page or have a different name from the one used in the script, this may cause syntax errors. If you create the objects on the page in which you pasted the example, the function should work.

Related Topics:

Overview of Script Functions

OpusScript Reference List