No internet connection
  1. Home
  2. Support

Macro not working, error about "no method"

By Matt Bauer @Matt_Bauer
    2025-05-14 06:37:09.360Z

    Macro not working, error about "no method"

    System Information

    SoundFlow 5.10.1

    OS: darwin 24.4.0

    ProductName: macOS
    ProductVersion: 15.4
    BuildVersion: 24E248

    Steps to Reproduce

    1. see script pasted below

    Expected Result

    I am trying to create a script that continuously runs in the background, detects when a plugin is opened, and disables the annoying red dot in the upper right corner that control plugin target focus.

    Actual Result

    i get an error about no method.

    Workaround

    no

    Other Notes

    here is the code I tried.

    // Initialize a set to keep track of processed window titles
    let processedWindows = new Set();

    // Function to check and disable the red target dot
    function disableRedDot() {
    const pluginWindows = sf.ui.proTools.windows.filter(w =>
    (w.title.includes("Plug-In") || w.title.includes("Insert")) &&
    !processedWindows.has(w.title)
    );

    for (const win of pluginWindows) {
        try {
            sf.wait({ ms: 300 }); // Wait for the window to fully render
    
        const redDot = win.children.flatMap(c => c.children)
            .find(el => el.role === "AXButton" && el.title === "Target" && el.value === 1);
    
        if (redDot) {
            redDot.elementClick();
            sf.log(`Disabled red target dot in: ${win.title}`);
        }
    
        processedWindows.add(win.title);
    } catch (err) {
        sf.log(`Error processing window: ${win.title}`);
    }
    

    }

    }

    // Run the function continuously in the background
    sf.engine.runInBackground(() => {
    while (true) {
    sf.engine.checkForCancellation(); // Allow the script to be stopped gracefully
    disableRedDot();
    sf.wait({ intervalMs: 1000, executionMode: 'Background' }); // Wait before the next check
    }
    });


    Links

    User UID: O9pF2iHHJVQkQO0C84K2NBQBCEj1

    Feedback Key: sffeedback:O9pF2iHHJVQkQO0C84K2NBQBCEj1:-OQCVi8SqyTpz59F3mSG

    Feedback ZIP: sMsdMBhgLbUho1eISUiadj4rF58E/JMh08mF8rbVe9xuw+j73LZXXC9LkhYl/Vl/w4O4TwI8+2fEAaLOuS2v4byh5mDjTpHfpVD8fQnXFMGSalF3GmXOPuGEcOEuz6s4zv/2JSPAfyJEzhgRHxgPmfI4KmyZuhVIvuV2qCNC5xrUBwdZ/Qt8xLllahJC+XzxZ9lC1YY26ZauibBFddCjgA8KkzPKcsaRTolEz+ItXPTvzdAf0qk8MKty7Sj81gBJkwEIgrnWNexVZMILJ+rW3ZnKwhjsqn4y9wiRDCWBV/CHx/eNAWaj9KPi/Zyc6drqqPtUaYbcB5FZDH65/IsL3PDQxdi5SdNC6yVK9rk7Jck=

    • 2 replies
    1. Hi Matt,

      I don't think sf.log is correct - the function is just called log. Further, it seems like you're logging the title object, not its value. This could be the reason you get the error. Change the log to:

      log(`Disabled red target dot in: ${win.title.value}`);
      

      And correspondingly, in the catch block.

      1. Small tip to make it easier to read the code - if you need help with a script or macro, there's an easier way to get the code shared with the community:

        https://soundflow.org/docs/help#script-macro