No internet connection
  1. Home
  2. Script Sharing

Get Menu Path Text from Menu and Popup Menus

By samuel henriques @samuel_henriques
    2021-04-22 17:19:23.042Z

    Inspired by @John_Morris that hates to type, this scripts helps with writing the path to menus without spelling mistakes.

    for menus:
    How do I copy and paste PT menu paths so that I don't have to type and miscapitalize #post-10

    for popups:
    How do I copy and paste PT menu paths so that I don't have to type and miscapitalize #post-11

    You can copy and paste each name to a macro, or hole path to a script

    Hope this helps

    • 21 replies

    There are 21 replies. Estimated reading time: 9 minutes

    1. Hell yeah! This is cool! You should put these in the store!

      1. Kitch Membery @Kitch2021-04-22 19:27:40.500Z

        Love this! Nice one @samuel_henriques :-)

        1. Kitch Membery @Kitch2021-04-22 21:19:50.986Z

          Here's an Idea to add @samuel_henriques,

          How about adding a third button to paste the paths into a Click Menu Item path property :-)

          Something like this.

          const menuPath = ["AudioSuite", "EQ", "F6 Mono"];
          
          menuPath.forEach(p => {
              sf.clipboard.setText({ text: p });
          
              sf.ui.frontmostApp.menuClick({ menuPath: ['Edit', 'Paste'] });
          
              sf.keyboard.press({ keys: 'return' });
          });
          
          1. samuel henriques @samuel_henriques
              2021-04-23 08:44:12.894Z

              Cool @Kitch I was wondering how to do this.
              It's working now, I'll update in a bit.

              But now I'm wondering If I could do a template the same as the "Open & Select Item in Popup Menu" or "Click Menu Item" and have a "pick" Menu Path button that would trigger the script.

              1. samuel henriques @samuel_henriques
                  2021-04-23 14:27:22.895Z

                  Almost there but need a bit more work,

                  At this time, to pick a new one I have to select the "Menu Path" area, focus the app I want a new path, and use a trigger to run the script this preset, at the end of the script, it will activate soundFlow and paste the path (your code)

                  Since I get the value from the script, is there a way to get that value in the "Menu Path" area?

                  Also. how do I hide the "Target Value" property to the advanced properties

                  Thank you

                  1. Kitch Membery @Kitch2021-04-23 18:09:22.470Z

                    @samuel_henriques,

                    Legend! I feel that implementing this as one command template is not the best approach (I may be wrong though).

                    I would suggest 2 scripts. One to collect and store the menu path (in a global variable) and another to paste it into the path.

                    I feel your script should maybe be used as more of a utility. Creating a command template for this seems counterintuitive as people will try and use it as a macro action.

                    I'm certainly not dismissing the idea, however, I feel Christian would have implemented the "Click Menu Item" Macro action this way, to begin with, if it was the best approach.

                    With all that said I will be using this script to save on some keystrokes and head-scratching due to spelling mistakes. :-)

                    1. samuel henriques @samuel_henriques
                        2021-04-23 18:26:27.664Z

                        Thanks mate, I arrived to the same conclusion. I was trying to complicate stuff that are already working properly.
                        I think I got a good thing now, I'll be posting this in the store for everyone to use.
                        Here's a video:

                        https://we.tl/t-2PvIoXzi8a

                        Let me know if you find any way to make this better.

                        And thank you to everyone.

                        1. Kitch Membery @Kitch2021-04-23 19:11:16.343Z

                          Fantastic!! I'll check it out shortly :-)

                • Great work!

                  1. samuel henriques @samuel_henriques
                      2021-04-23 09:18:20.038Z

                      UPDATE:

                      1. samuel henriques @samuel_henriques
                          2021-04-23 18:30:54.855Z

                          UPDATE: It's live in the store, my first one

                          https://soundflow.org/store/pick-path-from-popup-menu

                          1. samuel henriques @samuel_henriques
                              2021-04-23 19:01:02.908Z

                              And updated the store with the Menu Path version as well.
                              Here's a video:
                              https://we.tl/t-2YYhkLcXJv

                          2. A
                            Alex Oldroyd @Alex_Oldroyd8
                              2022-06-23 14:55:13.568Z

                              This is so helpful, @samuel_henriques ! Thank you. Just wondering how you would use the code to return the currently selected menu path of a popup menu as a string?

                              1. samuel henriques @samuel_henriques
                                  2022-06-23 16:34:30.383Z

                                  Hello Alex,
                                  As it is working now, the script sets the path in SF, and it sets the clipboard wit the path as well, so you can paste it on your script.

                                  1. AAlex Oldroyd @Alex_Oldroyd8
                                      2022-06-23 16:37:05.621Z

                                      Thanks Sam. I probably didn't explain myself.

                                      I'm attempting to fetch the currently selected menu path of a popup menu as an array to then use later on in the same script with Open & Select.

                                      I've been through the code of your script, but I can't work out how to isolate the already selected path as opposed to all possible paths... Thanks you!!

                                      1. samuel henriques @samuel_henriques
                                          2022-06-23 16:46:47.780Z2022-06-23 18:24:19.533Z

                                          got it,
                                          Here's an example. let me know if you get stuck.

                                          1. AAlex Oldroyd @Alex_Oldroyd8
                                              2022-06-23 16:52:45.941Z

                                              That's the one!! You're a hero! Thanks so much :)

                                      2. A
                                        Alex Oldroyd @Alex_Oldroyd8
                                          2024-08-22 11:34:42.297Z

                                          Hi Sam. And @Kitch ? Is it just me, or is this no longer working? I'm on Sonoma 14.1. It used to work so well on my old machine.

                                          Is there anything i can do to get it working again?

                                          Thanks
                                          Alex

                                          1. Kitch Membery @Kitch2024-08-22 18:04:56.110Z

                                            Hi @Alex_Oldroyd8,

                                            Can you provide more information, What is the script that you are using? ...and are you seeing an error message?

                                            1. AAlex Oldroyd @Alex_Oldroyd8
                                                2024-08-23 10:33:38.626Z

                                                When i use the Pick Path From Menu macro, i set it up as instructed and as i used to. When i run the script from a key command, with Logic focused, the window pops up to let me choose the menu items, but then i get an error and the script fails to enter the menu items into the Click Menu Item macro Menu Path .

                                                23.08.2024 11:31:51.86 <info> [Backend]: Logging unknown error in action (02) RunCommandAction: Pick Path From Menu: Line 24
                                                !! Command Error: pick path [user:clad2w0hi00013e10bl7r3ezg:cm06kn77c000cvb104seeklm3]:
                                                @Error running command user:1642499476722:cknunn6j600061910550vuyxl (pick path: Line 1)
                                                    Could not find running app with bundle id: '' (Pick Path From Menu: Line 24)
                                                
                                                
                                                1. Kitch Membery @Kitch2024-08-23 17:29:04.174Z

                                                  Hi @samuel_henriques, do you have any thoughts on this?