Versions Compared

Key

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

Description

This function adds a new SCRIPT SCRIPT task definition during runtime. If this function is invoked with the same source item ID and module ID multiple times, multiple tasks will be invoked when the source item is changed. The execution of the tasks is in reverse order (the last added as first – the first added as last).

For example:

Code Block
nxa.AddScriptTask("NETx\\VAR\\Numeric\\Item001", "NETx\\VAR\\Numeric\\Item002", true, true, true, 0, "nxa.LogInfo(\"1\")", 1001)
nxa.AddScriptTask("NETx\\VAR\\Numeric\\Item001", "NETx\\VAR\\Numeric\\Item002", true, true, true, 0, "nxa.LogInfo(\"2\")", 1001)
nxa.AddScriptTask("NETx\\VAR\\Numeric\\Item001", "NETx\\VAR\\Numeric\\Item002", true, true, true, 0, "nxa.LogInfo(\"3\")", 1001)
If item NETx\VAR\Numeric\Item001 is changed, the following system log entries will appear:
Code Block
3
2
1

The following code will delete all 3 tasks:

Code Block
nxa.RemoveScriptTask("NETx\\VAR\\Numeric\\Item001", 1001)

Signature

nxa.AddScriptTask (string, string, bool, bool, bool, number, string, number)

Parameters

NameTypeMandatory/OptionalDescription
sourceItemID stringM
sourceItemID

destinationItemIDstringM
destinationItemID

triggerOnReceiveboolMcorresponds to the
OnReceive
OnReceive parameter of the task definition
(cf. Section 4.5.2)
triggerOnSendboolMcorresponds to the
OnSend
OnSend parameter of the task definition
(cf. Section 4.5.2)
triggerOnSetboolMcorresponds to the
OnSet
OnSet parameter of the task definition
(cf. Section 4.5.2)
delaynumberMtime interval in milliseconds that the task will be delayed when triggered
scriptstringMLUA script name that will be executed when the task is triggered
moduleIDnumber
M(optional) ModuleID. Needs
OHas to be >
5000
1000. Can be referenced in the nxa.RemoveScriptTask function.

Return

...

TypeDescription
stringTaskID that identifies the created task.