Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Anchor
RTF32383431363a204368617074
RTF32383431363a204368617074
10: Scripts and the .NET Framework
Introduction
All programming in the FactoryStudio application consists of C# or Visual Basic 100% managed code designed to run in the Microsoft .NET framework. Users may create scripts in these languages that are run periodically or when specified events occur. The following sections describe how to create and work with these scripts:

  • Configuring Tasks explains how to create and manage tasks to be performed by scripts.
  • Configuring Classes explains how to create and manage classes to be used by tasks and other components of the application.
  • Working with the Code Editor explains how to use the built-in code editor to create and modify tasks and classes.
  • Configuring Expressions explains how to create expressions that can be used in scripts.
  • The Script Namespace presents the complete set of runtime objects for scripts.

...

  1. Go to Edit > Scripts > Tasks.
  2. Select a task name, or select the insert row (first row) to create a new task.
  3. Enter or select information, as needed.


Column

Description

Name

Enter a name for the task. The system lets you know if the name is not valid.

Code

Read-only. This specifies the language used for the code for this task. By default this is the language selected when you created the project. From the Code Editor tab, you can change the code language. To change the project default, go to Info > Settings.

Trigger

Enter or select the event (tag or other object) that should trigger the task execution, if any. The task executes when the value of the object changes.

Period

Enter the time interval that should occur between executions of the task, if there is no trigger.

Domain

Select where the script executes:

  • Client—Task executes on each client system. These are tasks that apply locally (on the user's computer), for example, report generation.
  • Server—Task executes on the server system. These are tasks that apply across the application, that is, globally.

InitialState

Select the task's initial state:

  • Enabled—Task is ready to run.
  • Disabled—Task is not ready to run. You may enable the task under specific conditions.

BuildStatus

Read-only. Status of the task code from the continuous compiling process.

  • Green check mark—Task runs without errors.
  • Red X—Task has warnings or errors. Double-click to go to the warning or error. Warnings are information only. Errors will prevent the code from running, but only that specific task. The rest of the application will run.

BuildErrors

Read-only. Displays any errors encountered during the last build.

EditSecurity

Set the security to enable who can edit the tasks

Description

Enter a description of this task.


    1. Double-click the row to access the Code Editor tab. You can now enter or edit the code for the task. See "Working with the Code Editor" below.
    2. Click Save.

...

  1. Go to Edit > Scripts > Classes.
  2. Select a class name, or select the insert row (first row) to create a new class.
  3. Enter or select information, as needed.

    Column

    Description

    Name

    Enter a name for the class. The system lets you know if the name is not valid.

    Code

    Read-only. This specifies the language used for the code for this task. By default this is the language selected when you created the projec From the Code Editor tab, you can change the code language. To change the project default, go to Info > Settings.

    Domain

    Select where the class executes:


  • Client—Class executes on each client system. These are classes that apply locally (on the user's computer), for example, report generation.
  • Server—Class executes on the server system. These are classes that apply across the application, that is, globally.|

    Content

    Read-only. Show the type of the content in the class (i.e.: method or namespace)

    EditSecurity

    Set the security to enable who can edit the tasks

    BuildOrder

    Set the order to build the classes

    BuildStatus

    Read-only. Status of the class code from the continuous compiling process.


  • Green check mark—Class runs without errors.
  • Red X—Class has warnings or errors. Double-click to go to the warning or error. Warnings are information only. Errors will prevent the code from running, but only that specific class. The rest of the application will run.|

    BuildErrors

    Read-only. Displays any errors encountered during the last build.

    Description

    Enter a description of this class.


  1. Double-click the row to access the Code Editor tab. You can now enter or edit the code for the class. See "Working with the Code Editor" below.
  2. Apply all namespaces that will be used in your code, e.g.
        1. "Using System"
        2. "System.IO.StremReader"
  3. Click Save.

...

  1. Go to Edit > Scripts > Expressions.
  2. Select an expression, or select the insert row (first row) to create a new expression.
  3. Enter or select information, as needed.

    Column

    Description

    Object

    Select an existing tag or object.

    Expression

    Enter the expression. The expression can be a basic mathematical expression, use a class, or be a conditional expression.

    Domain

    Select where the expression executes:


  • Client—Expression executes on each client system. These are expressions that apply locally (on the user's computer), for example, report generation.
  • Server—Expression executes on the server system. These are expressions that apply across the application, that is, globally.|

    Execution

    Select when the expression executes:


  • OnChange—The expression executes when the value of any tag in the expression changes.
  • TriggerOrTimeInterval—The expression executes when the trigger event occurs or when the interval set in the Period elapses.
  • ChangeOrStartup—The expression executes when the value of any tag in the expression changes or at startup.
  • TriggerOrTimeOfDay - The expression executes when trigger event occurs or on a specific time of day|

    Trigger

    Enter or select the tag or object that triggers the expression execution. The expression executes when the value of the object changes.

    DisableCondition

    Enter or select the tag or object that disables the expression execution.

    Time

    Specify the time when the expression will run

    Label

    Set a label to the specified class

    Build Messages

    Return the message status after the expression runs

    BuildStatus

    Read-only. Set after you click Verify.


  • Green check mark—Expression runs without errors.
  • Red X—Expression has errors.|

    BuildErrors

    Read-only. Displays any errors encountered during the last build.


  1. Click Verify to check the validity of the expression.

...