No internet connection
  1. Home
  2. How to

Pic Cut Track and Scene Cut Track Script Help

Hi Everyone,

I am relatively new to scripting and wondering if I can get help with setting up a macro. I am trying to build a script that allows me to fit clips based on the length of a dummy clip that is generated with EdiLoad. I have a track in pro tools named =SceneNos= that contains blank audio regions for each scene. I successfully made a script that selects the track and the region with these commands:

sf.ui.proTools.trackGetByName({ name: "=SceneNos=", makeVisible: true }).track.trackSelect();

sf.keyboard.press({  keys: "alt+tab, shift+tab",

sf.ui.proTools.selectionSet({
    selectionStart: globalState.rememberedSelection.selectionStart,
    selectionLength: globalState.rememberedSelection.selectionLength,

and then planning on triggering the cmd+T shortcut to fit it to the selection. Where I am stuck though is returning to the original track I had selected. Is there a way to store that information somewhere and recall it?

Many Thanks in advance!
Marios

  • 1 replies
  1. O

    Hey Marios,

    This will make Soundflow Remember your current Selection :
    globalState.previouslySelectedTrackNames = sf.ui.proTools.selectedTrackNames;

    This will take you back to them :
    sf.ui.proTools.trackSelectByName({ names: globalState.previouslySelectedTrackNames, deselectOthers: true });

    For what it's worth, I don't think you actually have to selectionSet, once you have the area highlighted when you return your selection will remain.

    Here's my version of 'select current shot and trim' (I have a whole package half baked with all sorts of pic cut related tools that I can't seem to make myself finish, but if there's any related to this that you'd like, reply here I probably have built them.)

    //Activate Pro Tools
    sf.ui.proTools.appActivate();
    sf.ui.proTools.invalidate();
    globalState.previouslySelectedTrackNames = sf.ui.proTools.selectedTrackNames;
    
    function trim() {
        ///Re-evaluate here... HACK TO REFRESH MENUS
        sf.keyboard.press({ keys: 'n', fast: true, repetitions: 2 });
        sf.ui.proTools.getMenuItem('Edit', 'Trim Clip', 'To Selection').elementClick();
    }
    
    
    /// Name your Pic cut Track here
    sf.ui.proTools.trackGetByName({ name: "=SceneNos=", makeVisible: true }).track.trackSelect();
    
    sf.keyboard.press({
        keys: "alt+tab, shift+tab",
    });
    
    sf.ui.proTools.trackSelectByName({ names: globalState.previouslySelectedTrackNames, deselectOthers: true });
    
    trim();