No internet connection
  1. Home
  2. How to
  3. Logic Pro

Logic Pro - Hidden Tracks Filtering

By Nicolas Aparicio @Nicolas_Aparicio
    2024-03-19 13:36:08.363Z

    Hi guys, just wondering if someone could give me a hand getting this sorted as I've reached a dead end.

    At the moment the code is almost done as it organises the available tracks by type and number but I'm trying to get it to look at the tracks in the Mixer window (which don't follow Hide or TrackStacks / all available tracks) and then comparing them to the ones in the Editor/Main Window.

    The tracks that match will be replaced by "", so only the hidden ones will show their name in the hidden column of the popup search.

    Basically line 43 is the issue.

    Cheers,
    Nic.

    
    
    sf.ui.logic.invalidate();
    sf.ui.logic.appActivate();
    
    const mixerWindow = sf.ui.logic.windows.whoseTitle.contains(" - Mixer").first
    const tracksWindow = sf.ui.logic.windows.whoseTitle.contains(" - Tracks").first
    const mixerPath = mixerWindow.title.value
    const tracksPath = tracksWindow.title.value
    
    
    /// Editor's Track's Names ///
    if (tracksWindow.exists) {
        sf.ui.logic.getMenuItem('Window', tracksPath).elementClick();
    };
    
    sf.ui.logic.getMenuItem('Edit', 'Select Tracks', 'All').elementClick();
    let allEditTracks = sf.ui.logic.selectedTrackNames
    
    /// Mixer's Track's Names ///
    if (mixerWindow.exists) {
        sf.ui.logic.getMenuItem('Window', mixerPath).elementClick();
    };
    
    let typesOfTrack = ['Summing Stack', 'Audio', 'Instrument', 'Auxiliary', 'Output']
    let allTracks = []
    
    
    typesOfTrack.forEach(logicTrack => {
    
        sf.ui.logic.getMenuItem('Edit', `Select ${logicTrack} Channel Strips`).elementClick();
    
        const mixerGroup = sf.ui.app("com.apple.logic10").mainWindow.groups.whoseDescription.is("Mixer").first;
        const mixerLayout = mixerGroup.children.whoseRole.is("AXLayoutArea").whoseDescription.is("Mixer").first;
        const selectedTracks = mixerLayout.getElements('AXSelectedChildren')
    
        selectedTracks.forEach(trackName => {
    
            var track = {
                "Number": trackName.children.first.value.value,
                "Name": trackName.getString("AXDescription").toLocaleString(),
                "Type": `${logicTrack} Track`,
                "Hidden": trackName.getString("AXDescription").toLocaleString().replace(allEditTracks.toLocaleString(), " "),
            }
            allTracks.push(track)
        });
    
    });
    
    /// Focus Edit Window ///
    if (tracksWindow.exists) {
        sf.ui.logic.getMenuItem('Window', tracksPath).elementClick();
    };
    
    
    /// PopUp Search ///
    var scrollToTrack = sf.interaction.popupSearch({
    
        title: 'Scroll to Track...',
        items: allTracks.sort((a, b) => parseInt(a.Number, 10) - parseInt(b.Number, 10)).map(item => ({
            number: item.Number,
            name: item.Name,
            type: item.Type,
            hidden: item.Hidden
        })),
        searchText: '',
        columns: [
            { key: "number", name: "Number", width: 10 },
            { key: "name", name: "Track Name", width: 30 },
            { key: "type", name: "Track Type", width: 30 },
            { key: "hidden", name: "Hidden?", width: 30 },
        ]
    
    }).item.name
    
    
    // sf.ui.logic.trackSelectByName({ names: [scrollToTrack] })
    
    
    
    • 0 replies