Calculations are a special type of token in Uncanny Automator that allow recipes to calculate values using standard math equations. This can include anything from simple math to more advanced functions, and other tokens can be incorporated into math equations.
A simple use for calculations would be a counter. Whenever a recipe is run, look up a value in user meta for a user and add 1 to it, then save that new value. A more advanced example might be looking up an expiration date and adding a week to it.
To include a calculation in a recipe, expand the Tokens section in your action and look for the Modifiers section. Within it, choose the Calculation entry.
Once selected, you can add any equation you want in the Formula section. Typically this would include one or more other tokens (using the * option on the right) paired with operators and numbers. Here’s a simple example of a counter that includes a lookup of a user meta value (for the course_count key) and then adding 1 to it. The action involved (not shown) would be Set user meta, as we would want to update the existing value with the new calculated value.
It’s important to use tokens in your formulas that output numbers. If a string is detected, it will be replaced with zero (0).
Formulas should typically include tokens, operators (i.e. +, -, * and /) and numbers. Here are a few sample formulas that are supported by calculations:
1 + 2 * 3 – 4
2 * (-3)
1 + ((2 – 3) * (5 – 7))
Any of the numbers above can, of course, be replaced with Automator tokens. These are just representative of the type of syntax that’s supported.
For advanced functions, refer to https://github.com/chriskonnertz/string-calc/tree/v1.0.12 for a complete list of what’s possible with the Calculation token type. Please note though that our support team can only provide assistance with basic math operations rather than complex formulas.