How to use applescript to disable macro by UUID?

Title says it all. I expect it should be easy but I can't figure it out, and my search of this forum failed.

Of course I knew that as soon as I posted this, I found something in this post by the excellent @ccstone !
All working now, thanks!

(Leaving this here to make that other post more findable)

1 Like

Perhaps worth a summary here, to shorten the link chain ?


(In AppleScript)

-- For example:
property uuid : "A3AD263F-2FF7-5F62-9412-F143139E01C9"

tell application "Keyboard Maestro"
    tell macro id uuid
        -- Toggle enabled ⇄ disabled
        set enabled to (not enabled)
        -- New value
        return enabled
    end tell
end tell

and in JavaScript:

Expand disclosure triangle to view JS source
(() => {
    "use strict";

    // For example:
    const uuid = "A3AD263F-2FF7-5F62-9412-F143139E01C9";

        macro = Application("Keyboard Maestro")

    return (
        // Toggle enabled ⇄ disabled
        macro.enabled = !macro.enabled(),

        // Return new value

1 Like