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

Logic pro - Open all used/active automation lanes on selected tracks

By Aleksander Waaktaar @Aleksander_Waaktaar
    2024-05-18 12:48:16.710Z

    Hi everyone,

    I want to create a macro that opens up all the used/active automation lanes on selected tracks.
    The way I usually do this in Logic is press "A" to show automation, and then press the sideways triangle symbol underneath the tracks power button (which opens up all the active automation lanes), and then repeat for each track. Does anyone have any ideas as to how I might go about creating a macro such as this?

    Best,
    Aleksander

    Solved in post #3, click to view
    • 13 replies

    There are 13 replies. Estimated reading time: 11 minutes

    1. Kitch Membery @Kitch2024-06-03 20:08:58.911Z

      This is a good request @Aleksander_Waaktaar. And one that I should add as a command template to the Logic Pro package.

      I'll take a look today, but I'm pretty sure I can make it happen.

      Please note that the Logic Pro Package is in its early stages and scripting Logic Pro using UI automation can be a little more complex as the UI elements can change depending on how the GUI is arranged.

      Also note that using the "Pick" button in Logic can be hit and miss due to some elements not being exposed to the OS.

      But thanks for asking about this functionality; it will be a good addition to the Logic Pro package.

      1. Kitch Membery @Kitch2024-06-03 22:01:24.584Z

        Hi again @Aleksander_Waaktaar,

        Try this script out.

        const logic = sf.ui.logic;
        logic.invalidate(); // Invalidates the current state to refresh the UI elements.
        logic.appActivate();
        
        /**
         * Ensure "Show Automation" in Logic's "Mix" menu is enabled.
         */
        function ensureAutomationView() {
            logic.menuClick({
                menuPath: ["Mix", "Show Automation"],
                targetValue: "Enable",
            })
        }
        
        /**
         * Toggles the visibility of automation lanes in a UI based on the specified target value.
         * The function defaults to toggling the current state if no specific action ("Show" or "Hide") is provided.
         *
         * @param {object} obj
         * @param {"Show"|"Hide"|"Toggle"} [obj.targetValue="Toggle"]
         */
        function showAutomationLanes({ targetValue = "Toggle" } = {}) {
            ensureAutomationView();
        
            // Retrieve the main track area which contains all track groups.
            const trackArea = logic.mainWindow.groups.whoseDescription.is('Tracks').first.groups.whoseDescription.is('Tracks');
            // Accessing the track headers from the track area.
            const trackHeaderGroup = trackArea.allItems[1].splitGroups.first.splitGroups.allItems[1].scrollAreas.first.groups.whoseDescription.is('Tracks header').first;
        
            // Fetches all selected tracks from the track headers.
            const selectedTracks = trackHeaderGroup.getElements('AXSelectedChildren').map(track => track);
        
            // Locates the automation lane disclosure arrows for each selected track.
            const automationLaneDisclosureArrows = selectedTracks.map(track => {
                return track.children.find(e => e.getString("AXHelp").startsWith("Automation lane disclosure arrow"))
            });
        
            // Processes each automation lane disclosure arrow to toggle its visibility based on the provided target value.
            automationLaneDisclosureArrows.reverse().forEach(disclosureArrow => {
                if (!disclosureArrow) return; // If no arrow is found, skip to the next iteration.
        
                const isExpanded = disclosureArrow.value.intValue === 1; // Check if the automation lane is currently expanded.
        
                // Logic to show, hide, or toggle the automation lanes based on the target value and current state.
                if ((targetValue === "Toggle") ||
                    (targetValue === "Show" && !isExpanded) ||
                    (targetValue === "Hide" && isExpanded)) {
                    disclosureArrow.mouseClickElement();
                }
            });
        }
        
        showAutomationLanes({ targetValue: "Show" });
        

        The targetValue in the last line can be set to either "Show", "Hide" or "Toggle", in case you need that functionality.

        Note: As I mentioned in my previous message I'll be adding this to the Logic Pro package as a command template with presets and icons for "Show", "Hide" & "Toggle".

        Reply1 LikeSolution
        1. Wow, this is amazing! Exactly what I was hoping for, thank you so much for your help @Kitch!
          I have tested it for a couple of hours this morning and so far it works perfectly.
          I've set the target value to "Toggle", and it just makes working with automation in Logic so much faster and less annoying.

          Thank you again, fantastic work!

          1. Kitch Membery @Kitch2024-06-04 18:08:28.794Z

            Awesome, I'm glad its working for you :-)

          2. In reply toKitch:
            SSubgroover @Subgroover
              2024-09-11 17:00:02.820Z

              This is awesome and would be a great help to my workflow!
              Only running scripts and stuff is new for me. I installed SoundFlow but I can't figure out what to do.

              I also searched for your "Toggle Track Automation Lanes" command on the Logic Pro page in the Soundflow Store, but I can't find that. Could you maybe help me out with this?

              Thank you in advance.

              1. Kitch Membery @Kitch2024-09-11 17:20:11.751Z

                Hi @Subgoover,

                Here is a video walking through how to copy a script from the SoundFlow User Forum into SoundFlow

                With that said, the "Toggle Track Automation Lanes" command was added to the Logic Pro package in Version 1.3.2.

                You should be able to download it from the SoundFlow store. To do so, follow these steps...

                In the SoundFlow app, click on the "Store" Tab.

                In the store's left column, select "Official SoundFlow Integrations"

                On the right side of the interface, you should see a package named "Logic Pro".

                If not already installed Click the "INSTALL" button

                Click on the "GO TO PACKAGE" button.

                The "Toggle Track Automation Lanes" Command template is located in the Logic Pro package in the "Track Functions Folder".

                Let me know if you need further assistance in finding it. :-)

                1. SSubgroover @Subgroover
                    2024-09-11 22:18:12.448Z2024-09-11 22:29:07.526Z

                    Thank you for the information. I'm trying to make it work, but the problem is that there are no packages in the "My Packages" folder, no matter what I try. If I create a new Package, nothing happens.

                    I installed the Logic Pro package as you described. It says "Successfully installed". When I click "Go To Package", it automatically goes to the Pro Tools package. The Logic package that I'm looking for is nowhere to find...

                    Sorry for these questions. I guess I'm a noob. :)

                    Edit: I was too quick. Just restarted Soundflow and now the Logic package is there!

                    Edit 2: And it works! You're my hero. This will be a big time saver for me!

                    1. Kitch Membery @Kitch2024-09-11 22:30:02.224Z

                      Thanks @Subgroover,

                      SoundFlow for some reason must have been stuck in a bad state. I'm glad that after restarting SoundFlow the Logic Pro package has now appeared.

                      Are there still no packages visible in your "My Packages" folder?

                      1. SSubgroover @Subgroover
                          2024-09-11 22:32:24.519Z

                          Yes. All the packages that I tried to create are visible now. Everything works!
                          After 22 years of using Logic I can finally customise it even more. A whole new world for me. I love it.

                          Thanks again!

                          1. Kitch Membery @Kitch2024-09-11 22:36:39.048Z

                            Wonderful!

                            If you have time this week maybe tomorrow afternoon, please reach out via email to support@soundflow.org and we can set up a Zoom call where I can give you a full Logic Pro package walkthrough.

                            1. SSubgroover @Subgroover
                                2024-09-11 23:15:44.332Z

                                Not tomorrow, but I will send you an email for sure. It's very interesting.

                                1. Kitch Membery @Kitch2024-09-11 23:16:52.000Z

                                  No worries. Reach out when you're ready. I should have some time next week also :-)
                                  Rock on!

                  • Kitch Membery @Kitch2024-06-03 22:41:32.796Z

                    FYI: I've added the "Toggle Track Automation Lanes" command template to the Logic Pro package v1.3.2 which should be available for download from the SoundFlow Store sometime next week. :-)