Script actions
This page has been automatically translated and has not been reviewed in detail yet. Therefore, the translation might not be completely accurate.
Script actions are a subtype of actions that only exist in script blocks. Another type of action would be component actoins, i.e. actions that send control information to components or end devices.
Script actions are added to a script block by selecting the "Script Action" function from the menu on the right:
You can then select a script action accordingly:
Comment
A comment is not an action in the strict sense, but only serves as a comment / text in the script (usually to explain something in the script):
Long comments are cut off in the block so as not to lengthen the blocks unnecessarily. If you select the comment, the complete text can be read in the context menu on the right:
Delay
Insert a delay in processing the actions. The value must be entered in milliseconds.
GraphQl
GraphQl client/server queries enable special actions in special cases and should only be used by developers.
(GraphQL is an open source data query and manipulation language and runtime system for answering queries with existing data.)
Example:
IF conditions
If you have selected an IF block and click on Conditions (Note: A corresponding ELSE part can be added using ELSE), then a dialog opens for adding one or more IF conditions:
Additional conditions can be added using the + button.
For each condition, a block variable (rectangle icon) or a global variable (globe icon) that can be defined here is selected in the first column 1. The comparison operators are in column two 2. In column 3 it is determined whether the comparison is made with a constant value, a local or a global variable and in column 4 the Constant or variable entered.
Only if all of these configured conditions are true (statemental logical AND operation) will everything within the IF statement be executed.
For 2 there are the following comparison operators:
- equals (for int or string variables)
- contains (for string variables)
- starts with (for string variables)
- ends with (for string variables)
Examples:
If the 'Number' block variable named "button" has the value 1, the IF condition is executed.
If the bool block variable named 'Local_bool' has the value "False", the IF condition is executed.
(A checkmark in the checkbox would expect the value "True".)
If the global text variable named 'TextVar01' contains the text from the global string variable 'button_Home_Color', the IF condition is executed.
Else
An Else branch can be added to define what happens alternatively if the if condition does not apply.
Note IF conditions cannot be nested.