Getting Timestamp of Most Recently Modified Macro

Perhaps something like this ?

Download Macro(s): Time stamps of every macro sorted in descending order.kmmacros (3.2 KB)

JS Source Code

(() => {
    "use strict";

    // jxaContext :: IO ()
    const jxaContext = () => {
        const main = () => {
            const
                km = Application('Keyboard Maestro'),
                epochDates = km.macros.modificationDate().map(
                    x => new Date(x).getTime()
                );
            return sortBy(
                flip(compare)
            )(epochDates).join("\n")
        };

        // GENERICS ----------------------------------------------------------------
        // https://github.com/RobTrew/prelude-jxa
        // JS Prelude --------------------------------------------------
        // compare :: a -> a -> Ordering
        const compare = a =>
            b => a < b ? -1 : (a > b ? 1 : 0);

        // flip :: (a -> b -> c) -> b -> a -> c
        const flip = op =>
            // The binary function op with
            // its arguments reversed.
            1 !== op.length
                ? (a, b) => op(b, a)
                : (a => b => op(b)(a));

        // sortBy :: (a -> a -> Ordering) -> [a] -> [a]
        const sortBy = f =>
            // A copy of xs sorted by the comparator function f.
            xs => xs.slice()
                .sort((a, b) => f(a)(b));

        // MAIN --
        return main();
    };

    return jxaContext();
})();
Macro-Image

Macro-Notes
  • Macros are always disabled when imported into the Keyboard Maestro Editor.
    • The user must ensure the macro is enabled.
    • The user must also ensure the macro's parent macro-group is enabled.
System Information
  • macOS 13.4
  • Keyboard Maestro v10.2
6 Likes