-
Notifications
You must be signed in to change notification settings - Fork 1
Functional Substitutions
These substitutions are built into the program. To use them, wrap the substitution target in double brackets in one of the supported fields, then run the script through the right-click (context) or Tools menu. Different from built-in substitutions, these substitutions take arguments and calculate a return value based on them. Arguments are separated with semicolons.
Example: [[fAdd;5;3]] would evaluate to 8.
- Built-in substitutions cannot be overwritten by user-created substitutions.
- Built-in substitutions are all case-insensitive.
fAdd;val1;val2[;...;valN]
Adds together the arguments. Non-numbers are treated as 0.
fSub;val1;val2[;...;valN]
Subtracts the arguments from each other. Non-numbers are treated as 0.
fMul;val1;val2[;...;valN]
Multiplies the arguments together. Non-numbers are treated as 1.
fDiv;val1;val2[;...;valN]
Divides the arguments by each other. Returns 0 if any argument is 0. Non-numbers are treated as 1.
fMod;val1;val2
Returns the modulo of the first number by the second number. Non-numbers are treated as 1.
fFloor;val1
Returns the argument, rounded down.
fCeil;val1
Returns the argument, rounded up.
fRound;val1
Rounds the argument to the nearest integer.
fPrefix;string;int
Returns the first int characters of string.
fSuffix;string;int
Returns the last int characters of string.
fSubstr;string;int1;int2
Returns the characters between the int1 and int2 indices of string.
fLength;string
Returns the number of characters in string.
fGetIndexOf;string1;string2[;int]
Returns the index of the int-th occurrence of string2 in string1. Returns -1 if not found. int defaults to 1 if not specified.
fGetLastIndexOf;string1;string2[;int]
Returns the index of the int-th occurrence of string2 in string1, counting from the end. Returns -1 if not found. int defaults to 1 if not specified.
fFindReplace;string1;string2;string3
Replaces all instances of string2 in string1 with string3. String3 defaults to "" (empty string) if not specified.
fToUpperCase;string
Returns string with all characters in upper case.
fToLowerCase;string
Returns string with all characters in lower case.
fToTitleCase;string
Returns string, capitalized following these steps:
- Make the whole string lowercase
- Capitalize the first letter of all words that are not
a,an,and, orthe - Capitalize the first letter of the first and last words
fEquals;val1;val2[;...;valN]
Returns 1 if all arguments are equal, 0 otherwise.
fAnyEquals;val1;val2[;...;valN]
Returns 1 if val1 is equal to any val(N>1), 0 otherwise.
fEquals;val1;val2[;...;valN]
Returns 1 if any arguments are different, 0 otherwise.
fGreaterThan;val1;val2[;...;valN]
Returns 1 if all arguments valN are greater than val(N-1).
fLessThan;val1;val2[;...;valN]
Returns 1 if all arguments valN are greater than val(N+1).
fGreaterEqual;val1;val2[;...;valN]
Returns 1 if all arguments valN are greater than or equal to val(N-1).
fLessEqual;val1;val2[;...;valN]
Returns 1 if all arguments valN are greater than or equal to val(N+1).
fOr;val1;val2[;...;valN]
Returns 1 if any argument evaluates to true. 0 otherwise. 0 and "" (the empty string) evaluate to false. All other values are true.
fAnd;val1;val2[;...;valN]
Returns 1 if all arguments evaluate to true. 0 otherwise. 0 and "" (the empty string) evaluate to false. All other values are true.
fNot;val1
Returns 0 if the argument evaluates to true, 1, otherwise. 0 and "" (the empty string) evaluate to false. All other values are true.
fBranch;val;string1[;string2]
If val evaluates to true, returns string1. Otherwise, if string2 was specified, returns that. Otherwise, returns "" (empty string). 0 and "" (the empty string) evaluate to false. All other values are true.
fSubstExists;string
Returns 1 if string is a valid substitution, 0 otherwise.
fSafeExecute;val1;val2[;...;valN]
Checks each value to see if it is a valid substitution. If a value is a valid substitution, it is returned without being processed. If no values are valid substitutions, "" (empty string) is returned.
Ex. [[fSafe;banana;apple;cCamera;potato]] would return cCamera (assuming apple, banana, and potato are not valid substitutions). [[[[fSafe;banana;apple;cCamera;potato]]]] would return cCamera from fSafe, and then the surrounding brackets would cause it to be processed, returning the model of the camera used to take the photo.