Randomly reduce 5 to 50 days from the current date

please i need help

i need macro that take the current date
and randomly reduce 5 to 50 days

example
the current date day of this day is 07/21/2019
(month/day/year)
so one triggering of the macro will randomly reduce 5 days
so the output will be 07/16/2019

and so on
another triggering of the macro will randomly reduce 10 days
so the output will be 07/11/2019

and so on
until the max of reduce 50

I'm not sure I fully understand your desired workflow, but here you go. Assuming I've got the math right, this macro should paste a different random date between 5 and 50 days in the past every time it's run:

Paste Random Past Date Between 5-50 Days.kmmacros (1.4 KB)
image

my friend
when i trigger the macro the keyboard maestro crash

today is 07/16/2019
so i need macro that reduce number of day from this day
from 5 to 50
one time it could be 5 days reduce
second time it could be 15 days reduce
3th time it could be 25 days reduce
and that it will paste as a text in this format: month/day/year

The macro doesn't crash for me. Which version of Keyboard Maestro and macOS are you running? I'm running 8.2.4 on Mojave 10.14.5.

I'm afraid I'm also more confused about your requirements. Do you want the macro to always choose a past date in multiples of 5 with a max of 50, or can it be any number between 5 and 50? Do you want it to be a random number as per your thread title, or to go 5 → 15 → 25 and so on until 50, which is not random? Any of these options are possible, but I'm afraid you need to be more clear about what you want.

In the interest of providing options, here's a macro that will paste a random past date in multiples of 5 up to 50 using a variable array and different token than my first macro, ICUDateTimeMinus:

Paste Random Past Date Between Multiples of 5 Up to 50 Days.kmmacros (1.8 KB)
image

Really? If you have a crash, please send me the crash report.

It would be in the ~/Library/Logs/DiagnosticReports folder

You can get to ~/Library in the Finder by holding down the shift (or option) key and selecting Library from the Go menu in the Finder.

Email it to support@stairways.com

However if that macro is crashing, I think something is very wrong.

If you want to produce the date that is 5 to 50 days from now, use something like:

%ICUDateTimePlus%5+RAND(45)%Days%MM/dd/yyyy%

image|322.5x67.5

Technically, that will be 5-49 days from now, so you may prefer 5+RAND(46).

But it sounds like you want to take the current day, subtract five days, insert that. But then you want to repeat the macro a second time and get the current day minus 10 days, and so on.

In that case, you either need two macros, or some way for Keyboard Maestro to know whether to produce the next in the sequence or the date five days before now - when do you want the sequence to reset?