Doing Calculations with Keyboard Maestro

Friends, please help!

I can not figure out how to carry out operations with numbers in the clipboard. I want to cut a number to the clipboard. Multiply it by three. And paste it in the same place where you copied it.

For example. I cut out 3333. I paste 9999.

Is it possible to make such a script? Or Keyboard Maestro does not support such a function?

Thanks a lot for your help!

Assuming the number is selected, simply


Or if you want to expand it to multiple actions for clarity/simplicity:



This is amazing! Thank you so much!

Thanks a lot for your help! With integers, everything works amazingly! Please tell me how to be fractional numbers? Such a sequence does not work with them. If any solution for fractional numbers? Thanks a lot in advance!

I just tried Peter's first method with real numbers and it works as expected. I selected 3.3 in a BBEdit document, hit my trigger and got 9.9 replaced in the document.


How are you formatting these "fractional" numbers? 1.333 or 1 1/3 or 1 ⅓ or 1,333 ?

Complete guess, but I am wondering if the problem you are having is a regional issue of using a , (comma) as the decimal separator instead of a . (period/full-stop)

1.333 is the format Keyboard Maestro works with, but 1,333 won't work.

If that is the issue, you can use Search and Replace Actions before and after the calculation to swap commas for periods/full-stops and then back again.

EXAMPLE Calculate with commas as decimal separator.kmmacros (3.9 KB)

Click to Show Image of Macro

But this is just a guess until you give an example of the numbers you are having trouble with.

1 Like

If you want to process the copied clipboard and calculate the result in to a decimal, you can use the Filter action to perform the Calculate operation.

If you are wanting to multiply an input like “1/4” and get an answer like “3/4”, then that is a whole different problem for which I don't really have an answer.

1 Like