Automation : Syntax
What is Syntax?
Syntax refers to the formatting rules that need to be followed when writing a script. The use of syntax ensures that Chasys Photo will correctly interpret the script.
Syntax Rules
A script is made up of a list of instructions called statements. Each statement consists of a keyword (a command), parameters (if required) and a semi-colon at the end. For example, the second item in the list below instructs Chasys Photo to perform a rotation transform with angle as 45 degrees:
fx_synenhance; |
A script may contain descriptive text; these are called comments. The starting point of a comment is denoted by two forward slashes. The comment spans the rest of the line it appears on:
//This is a comment |
Chasys Photo ignores comments when it is executing the scripts.
Document Conventions
The parameters used by some commands may require special formatting; this information is conveyed in the documentation using format specifiers as shown below:
| Format Specifier | Meaning |
| #color | Color value. Colors are specified using 32 bit hexadecimal digits padded to 8 symbols and preceded by a hash symbol "#". The lowest 8 bits are for blue, then green, then red, and finally alpha in the highest position. For example, R=0 G=128 B=255 A=192 is expressed as #c00080ff. |
| "string" | Quotes string. The parameter is a string that may contain any character except return, new line and double quotation marks. The start and end of the string are denoted by double quotation marks. |
| ... | Variable list. The number of parameters is not fixed. |
Some parameters may only accept certain values or ranges of values; this information is conveyed in the documentation using range specifiers as shown below:
| Range Specifier | Meaning |
| [0..360] | Numerical range. Any numerical value between and including the indicated numbers may be specified. For example, when [0..100] is indicated, you may specify a value like 64.5. |
| [horz, vert] | Option. You may specify any one of the indicated values. For example, you may specify "horz" or "vert", but not both. |
| [r|g|b|a] | Color channel flags. The parameter is a set of flags that may be combined to indicate which color channels to use; e.g. "rg" means "red and green". |
| [1|2|3|4] | Numerical flags. The parameter is a set of numerical flags that may be combined by addition; i.e. to specify item "1" and item "2", set the parameter to "3" (i.e. 1+2). Normally used for color-channel specification such that B=1, G=2, R=4 and A=8, so that if you want to set R and B you specify 5, i.e. 1+4. |