The Script Editor pane

The Script Editor pane below appears the middle of the Script Object window when you add a Script Object to a page. The Script Editor pane is used to enter your script. There is no limit to the size of your script; it may be one line or a thousand lines long.

Helpful things to consider

1. Colour coded script – when you type the script in your publication certain words will change colour. The default settings are:

Note:
To change the colours of the text to your own preference, select Options from the Tools menu at the top of the Opus Editor and then select the Script folder.

2. The Script tab in the Page Organiser on the left-hand side of the Opus Editor contains the complete list of OpusScript functions in the Categories to which they belong.

3. You can add one of the OpusScript functions by double-clicking the name of the function. The new function will be added at the point where the cursor is currently flashing in the Script Editor pane – this is the skeleton of the code, you will have to fill in the details, such as parameters, if required.

4. When an OpusScript function is typed in manually or added using the Script tab, a Script tooltip will appear showing the correct syntax for the function along with a brief description of its function and the Return Value it provides (if applicable).

Note:
If you do not want the tooltip to appear or for it to appear in a modified format, select Options from the Tools menu at the top of the Opus Editor and then select the Script folder – you can then change the tooltip settings.

5. The EasyCode list in the Script Object Toolbar allows you to add a skeleton code for commonly used functions, such as, the if and else function. This is also very useful for ensuring that you enter the correct syntax for these functions, as it is easy to forget to add a curly bracket sometimes.

6. The Go to a function list in the Script Object Toolbar allows you to quickly jump to points in your script by selecting the function name you want to go to from the list.

7. If you type an OpusScript function in the wrong case e.g. show() instead of Show(), Opus will auto-correct the spelling. This is a particularly useful feature because scripts often do not work because of something as simple as a spelling mistake.

Note:
If the same Script Object is required for more than one page in your publication, save the Script Object as an external file and import the file into a Script Object for each page.

If a Script Object on one page will be similar but NOT the same as a Script Object on another page, make a copy of the Script Object and then edit as required – see External Scripts for more information.

Related Topics:

The Script Object window

The Script Object Toolbar

The Error Message pane

External Scripts