Skip to content

Script package

Scripts use the file extension *.script. These files contain structured text and simple commands written in the script language. The interpreter included in the script package analyzes and executes the content of these files.

Calling scripts with the script interpreter

  1. A script event occurs.
  2. The system calls the corresponding script interface.
  3. The system creates an interface file with information about the affected component.
  4. The interpreter starts and checks whether a script is assigned to this component type for the script event. It looks for a file named {Component type ID}.script.

    • If it does not find a match, the system checks whether the {Script event}.ini file defines a default script.
    • If no default exists, the system checks whether the {Script event}.ini file assigns a script to the component type.

    Info

    Place the SCRIPT file in the same folder as the interpreter.

  5. If the interpreter finds a script, it analyzes and executes the instructions.
    If no script is found, the system executes its default action.

Example

A user selects an RSLogix 5000 project and starts the editor with F4.
The component type ID of the RSLogix component is DC14F6773F0B4705886A3457646C92B6.

The BeforeEdit.ini file looks like this:

``` ini
[General]
Default =
DC14F6773F0B4705886A3457646C92B6 = RSLogix5000_OldEditor
  1. octoplant calls the BeforeEdit script interface.
  2. The script interface creates the interface file and starts the interpreter.
  3. The interpreter checks whether a script is assigned to the component type ID.
  4. Thw RSLogix5000_OldEditor.script script is assigned to the component type ID.
  5. The interpreter analyzes the instructions in the SCRIPT file and executes them.
  6. After the script finishes, the system continues the process and applies the return values of the script.