Formatting Numbers

Prior to Keyboard Maestro 8, about the only way to format a number was using the Set Variable to Calculation action (or resorting to using a scripting language).

Keyboard Maestro 8 adds a couple new ways. You can use the CalculateFormat token:

%CalculateFormat%3+4*SQRT(5)%#,##0.##%

The format can either be any format from the Unicode Technical Standard #35, or it can be one of the specific localized format like “Decimal” or “Currency”.

There are also new tokens for returning the result in Hexadecimal, Octal or Binary with a fixed number of digits (leading digits are filled with zeros).

For example:

%Hex2%77% ➤ 4D
%Dec5%432% ➤ 00432
%Oct3%27% ➤ 033
%Bin8%53% ➤ 0110101
3 Likes