No internet connection
  1. Home
  2. Macro and Script Help

Voiceover with fill sometimes works, often fails.

By Jonathan Johnson @Jonathan_Johnson
    2025-04-22 00:14:00.275Z

    Title

    Voiceover with fill sometimes works, often fails.

    What do you expect to happen when you run the script/macro?

    Script fails at line 22

    Are you seeing an error?

    Fail at the Batch fade

    What happens when you run this script?

    script stops

    How were you running this script?

    I used a keyboard shortcut while SoundFlow was focused

    How important is this issue to you?

    4

    Details

    {
        "inputExpected": "Script fails at line 22\n",
        "inputIsError": true,
        "inputError": "Fail at the Batch fade",
        "inputWhatHappens": "script stops",
        "inputHowRun": {
            "key": "-MpfwjqdCPWPz1IbQT3I",
            "title": "I used a keyboard shortcut while SoundFlow was focused"
        },
        "inputImportance": 4,
        "inputTitle": "Voiceover with fill sometimes works, often fails."
    }

    Source

    const fadePresetNumber = 1;
    
    /**
     * @param {'Up'|'Down'} direction
     */
    function navigateTrack(direction) {
        if (direction === 'Up') {
            sf.ui.proTools.getMenuItem("Edit", "Selection", "Extend Edit Up").elementClick();
            sf.ui.proTools.getMenuItem("Edit", "Selection", "Remove Edit from Bottom").elementClick();
        }
        if (direction === 'Down') {
            sf.ui.proTools.getMenuItem("Edit", "Selection", "Extend Edit Down").elementClick();
            sf.ui.proTools.getMenuItem("Edit", "Selection", "Remove Edit from Top").elementClick();
        }
    }
    
    function createFades(presetNum) {
        sf.ui.proTools.getMenuItem('Edit', 'Fades', 'Create...').elementClick();
    
        var batchFadesWin = sf.ui.proTools.windows.whoseTitle.is('Batch Fades').first.elementWaitFor({ timeout: 500 }, 'Could not find Batch Fades window').element;
    
        batchFadesWin.buttons.whoseTitle.is('Fade Preset Toggle').allItems[presetNum - 1].elementClick({}, 'Could not click preset button');
    
        batchFadesWin.buttons.whoseTitle.is('OK').first.elementClick();
    
        batchFadesWin.elementWaitFor({ waitType: "Disappear" });
    }
    
    function main() {
        sf.ui.proTools.appActivateMainWindow();
    
        var originalSelection = sf.ui.proTools.selectionGet();
    
        const oldEditMode = sf.ui.proTools.editModeSet({ mode: "Slip", }).oldMode;
    
        sf.ui.proTools.getMenuItem('Edit', 'Fades', 'Delete').elementClick();
    
        const cursorToolCluster = sf.ui.proTools.mainWindow.cursorToolCluster;
        cursorToolCluster.buttons.whoseTitle.startsWith('Grabber tool').first.popupMenuSelect({
            isRightClick: true,
            menuPath: ['Object']
        });
    
        navigateTrack("Down");
        navigateTrack("Up");
    
        sf.ui.proTools.getMenuItem('Edit', 'Copy').elementClick();
    
        navigateTrack("Down");
    
        sf.ui.proTools.getMenuItem('Edit', 'Paste').elementClick();
    
        sf.ui.proTools.toolsSelect({ tool: "Selector", });
    
        navigateTrack("Up");
        navigateTrack("Down");
    
        sf.ui.proTools.getMenuItem('Edit', 'Copy').elementClick();
    
        navigateTrack("Up");
    
        sf.ui.proTools.getMenuItem('Edit', 'Paste').elementClick();
    
        navigateTrack("Down");
    
        sf.ui.proTools.getMenuItem('Edit', 'Clear').elementClick();
    
        sf.ui.proTools.selectionSet({
            selectionStart: originalSelection.selectionStart,
            selectionLength: originalSelection.selectionLength,
        });
    
        sf.ui.proTools.getMenuItem('Edit', 'Heal Separation').elementClick();
    
        navigateTrack("Up");
    
        sf.ui.proTools.editModeSet({ mode: oldEditMode, });
    }
    
    //Change the Main Counter to Samples for the duration of the main function
    sf.ui.proTools.mainCounterDoWithValue({
        targetValue: 'Samples',
        action: () => {
            main();
            createFades(fadePresetNumber);
        }
    });
    

    Links

    User UID: nd1Ljv8IdvcMPlWQRihpRZT19jG2

    Feedback Key: sffeedback:nd1Ljv8IdvcMPlWQRihpRZT19jG2:-OOPq251iYBo4wbxSkxO

    Feedback ZIP: NcbTaWcmKrMk5T8ejf4GWGcr2L4Bp9Ho64NHVngDbiGJ0TVPMJc43OTGSD8tM9ek9i5NG7Vpa2e47B41Ks7OjJwP610viMfbc1KfNYAyDdCpl/Nxqm/EpxnM5oJPMCC8K0j3Maqln2pecoWuJm1nv8Dqm0zHnIc4uGgrSLqiXQSJeoYPfWrm4BpkjfNMS1D6Bg3fUx6vbuE9/mCUeDEZ0YFzoJi6Vj8dHO8Dzzfv1/WUToWnLDmjoxpSRkO9IBR3BhjN7lFnPsBkQT+IPPSpI2u0H2DH9CPEfCUbahbaSJUn6DQ8TvP2UZ9x4HjH9hBUMTT6rQteqAb++cET60BfkjvVTIz4bzsVmEvQXcFXbCk=

    • 3 replies
    1. Kitch Membery @Kitch2025-04-22 15:49:44.902Z

      Hi @Jonathan_Johnson

      Untested, but try changing line 22 to this...

          batchFadesWin.buttons.whoseTitle.startsWith("Fade Preset Toggle").allItems[presetNum - 1].elementClick({}, 'Could not click preset button');
      

      Let me know if that works for you.

      1. JJonathan Johnson @Jonathan_Johnson
          2025-04-23 19:07:23.339Z

          It's Perfect! Thanks!!

          1. Kitch Membery @Kitch2025-04-23 20:05:52.065Z

            Awesome!