Skip to content

Script Commands

Bashar Astifan edited this page Jan 6, 2022 · 14 revisions

Back to Commander

Commands List

Defines

define: used to define/update new variable

COMMAND STRUCTURE: define [variableName];, variableValue

if the variable already defined will be updated with the new value

You can use value from another variable as ID

EXAMPLE: define [variableName];, [sourceVariableName]

As Commander compiler based on text replacements.. large text could break the script this will help to resolve the issues when your data contains multi lines


func: used to define/update new function

COMMAND STRUCTURE:

func [functionName];, (command)

use call command to invoke the function

EXAMPLE:

func [variableName]{
command1
command2
}

If you want inline syntax, you can define multiple command by split them with !#! or \n

func [variableName];, (command1!#!command2!#!command3)

to call the function use call command:

EXAMPLE: call [functionName]

EXAMPLE (With Parameters): call [variableID]|paramName1:Value|paramName2:Value..etc


set: used to set new value for specific variable

COMMAND STRUCTURE:

set [variableName];, variableValue

IS IT SAME AS define?

No, with set command you can deal with specific values as listed below:

  • ++: set [variableName];, ++
  • --: set [variableName];, --
  • +(varaible or number): set [variableName];, +value
  • -(variable or number): set [variableName];, -value
  • *(variable or number): set [variableName];, *value
  • /(variable or number): set [variableName];, /value
  • any string/numeric value: set [variableName];, value

you can also increase the value directly:

[variableID]++, [variableID]--

If you want to set value from another variable as ID

EXAMPLE:

define [variableName];, [sourceVariableName]

this will help to resolve the issues when you data contains multi lines



Includes

include: used to include another script into the current one

COMMAND STRUCTURE:

include [fileID]


includel: used to include another script into the current one

COMMAND STRUCTURE:

includel fileLocation

the file should be available in the files storage

you can include any file in the script folder by it's name (for script bundle)

EXAMPLE:

includel extraContent.wutc



Strings

regex: extract string using regex

COMMAND STRUCTURE:

regex [variableID];, pattern;, [targetID]

pattern like:

define [sourceID];, Welcome To (WUT)
regex [testID];, \(.*\);, [sourceID]

testID will be (WUT)

be aware to the special chars \ - ( - < -> and don't forget to add \ before them \ - ( - < - >

if you got any parsing error message then you have special char in your pattern


regexg: extract string using regex with group

COMMAND STRUCTURE:

regexg [variableID];, pattern;, group;, [targetID]

pattern like:

define [sourceID];, Welcome To (WUT)
regexg [testID];, Welcome (?<middle>\w+);, middle;, [sourceID]

testID will be To

as you can see this will return only the requested group

be aware to the special chars \ - ( - < -> and don't forget to add \ before them \ - ( - < - >

if you got any parsing error message then you have special char in your pattern


regexc: extract string collection using regex with group

COMMAND STRUCTURE:

regexc [variableID];, pattern;, group;, [targetID]

pattern like:

define [sourceID];, Welcome To (WUT) Welcome test collection
regexc [testID];, Welcome (?<middle>\w+);, middle;, [sourceID]

testID will be To,test

as you can see this will return only the requested group

be aware to the special chars \ - ( - < -> and don't forget to add \ before them \ - ( - < - >

if you got any parsing error message then you have special char in your pattern

Clone this wiki locally