Tips: Show Examples of How KM8's New Features Have Improved Your Macros/Workflow

All right, here's the best (read: only, at least for now) example I have to share. Background: a few months ago, I made a thread asking for help with a date converter macro, which in turn led to this thread where Peter teased an upcoming KM8 improvement that promised to make this surprisingly tricky task considerably simpler. Now that KM8 is here, I was finally able to take a crack at streamlining it and seeing how much simpler I could make it (spoiler: quite a lot simpler).

To illustrate, here's the original, KM7 macro:

And here's the newly KM8-optimized macro:

(download for anyone interested) KM8-Optimized JP Dates → US Dates.kmmacros (5.7 KB)

To put that in number form, the original macro used 25 actions and 4 variables altogether, and the KM8-optimized one uses 9 actions and zero variables. The new version achieves this entirely thanks to KM8's ability to use regex matches and capture groups in tandem with the %Calculate% token, especially the new %CalculateFormat% token (without which the date conversions couldn't be formatted properly). These new abilities also completely eliminate the need for the original's For Each loops and variable "placeholders" (which were used in the original version to ensure that only one matching pattern at a time was used for calculation and replacing) as the necessary calculations can now be searched, done in-place, and written back en-masse.

I doubt this particular macro will be very useful for anyone who doesn't regularly work with Japanese dates, but hopefully this helps show what KM8 makes possible :slightly_smiling_face:

2 Likes