No internet connection
  1. Home
  2. Packages
  3. Pro Tools Field Recorder

Select [Ask] Channel For Selected Script stops if name not found

By Linus Gidstedt @Linus_Gidstedt
    2022-12-07 11:01:03.813Z

    Title

    Select [Ask] Channel For Selected Script stops if name not found

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

    It is supposed to ask for a channel name and switch to it on all selected clips. But it stops if the channel name wasn't found and aborts. It should in my opinion continue to the next clip instead and complete the script

    Are you seeing an error?

    Error selecting clips (Select [Ask] Channel for all selected clips: Line 7) Could not select matching channel name for clip

    What happens when you run this script?

    I enter a channel name and if its not found the script aborts

    How were you running this script?

    I used a Stream Deck button

    How important is this issue to you?

    5

    Details

    {
        "inputExpected": "It is supposed to ask for a channel name and switch to it on all selected clips. But it stops if the channel name wasn't found and aborts. It should in my opinion continue to the next clip instead and complete the script",
        "inputIsError": true,
        "inputError": "Error selecting clips (Select [Ask] Channel for all selected clips: Line 7)\n    Could not select matching channel name for clip",
        "inputWhatHappens": "I enter a channel name and if its not found the script aborts",
        "inputHowRun": {
            "key": "-MpfwmPg-2Sb-HxHQAff",
            "title": "I used a Stream Deck button"
        },
        "inputImportance": 5,
        "inputTitle": "Select [Ask] Channel For Selected Script stops if name not found"
    }

    Source

    
    var channelName = sf.interaction.popupText({
        title: 'Channel name'
    }).text;
    
    sf.ui.proTools.appActivateMainWindow();
    
    sf.ui.proTools.clipSelectFieldRecorderChannel({
        channelNameContains: [channelName.trim()],
    });
    
    

    Links

    User UID: mag5iiYxaiZ5xli5fz9O3mUjFyp1

    Feedback Key: sffeedback:mag5iiYxaiZ5xli5fz9O3mUjFyp1:-NIgEkHMktFxC5fynm_G

    Feedback ZIP

    Solved in post #11, click to view
    • 23 replies

    There are 23 replies. Estimated reading time: 9 minutes

    1. S
      SoundFlow Bot @soundflowbot
        2022-12-07 11:01:06.250Z

        Thanks for posting a question or an issue related to the 'Pro Tools Field Recorder' package.
        This package is made by @chrscheuer. We're auto-tagging them here so that they will hopefully be able to help you.

        1. Hi Linus,

          This is by design, but I think it should be possible to add an option to the action for it to ignore errors on the individual clips. This behavior would be opt-in though.

          1. You should also be able to build something like this yourself by iterating through the clips via clipDoForEachSelected and doing your own error handling logic.

            1. Linus Gidstedt @Linus_Gidstedt
                2022-12-07 14:06:58.804Z

                Do you mean I should make a completely new script and use clipDoForEachSelected or somehow implement your script with clipDoForEachSelected? I have thought of making my own script for this but haven't been able to figure out how to access the Matching Field Recorder Channels menu.

                1. Yea exactly - something like that. I don't have time right now to guide through how to make such a script, but wanted to point out that it should be possible to write.

                  I've taken a note of the feature request to change the behavior or add new behavior to the original script - just wanted to give you a pointer on where to get started in case you wanted something up and running quicker (you'd need the community's help to implement it)

                  1. Linus Gidstedt @Linus_Gidstedt
                      2022-12-07 16:10:08.320Z

                      And I guess it's not possible to get a version of the source code of that script to play with?

                      1. There's no Javascript source code - it's an internal function.

                        1. Linus Gidstedt @Linus_Gidstedt
                            2022-12-08 08:32:14.357Z

                            Ok got it!

                    • In reply tochrscheuer⬆:
                      Linus Gidstedt @Linus_Gidstedt
                        2022-12-09 21:26:56.003Z

                        This function seems to do the trick

                        function selectChannelName() {
                            sf.ui.proTools.clipSelectFieldRecorderChannelOneClip({
                                channelNameContains: [channelName.trim()],
                                isOkayIfNoMatch: true, 
                                onError: "Continue"
                            })
                        }
                        sf.ui.proTools.clipDoForEachSelectedClip({action: selectChannelName});
                        

                        Is there any downside to using this that I'm missing compared to sf.ui.proTools.clipSelectFieldRecorderChannel()?

                        Reply1 LikeSolution
                        1. This is pretty much what I had in my head! Awesome you got it working :) I'm not sure if you're missing out on some error handling, but given that that's what you wanted to customize, I'd say this is the right way to go.

                      • In reply tochrscheuer⬆:
                        Linus Gidstedt @Linus_Gidstedt
                          2022-12-07 13:40:48.949Z

                          Thanks for replying! The script sf.ui.proTools.clipSelectFieldRecorderChannelOneClip has an argument called isOkayIfNoMatch. It sound like that is what I am asking for but it still throws an error if there is no match and only works for one clip obviously.

                          1. NNicolai Linck @Nicolai_Linck7
                              2023-01-12 17:12:08.435Z

                              Hi Linus. Im looking for the same thing, did you get it to work? I have tried your code but im still getting error messages.

                              1. Linus Gidstedt @Linus_Gidstedt
                                  2023-01-12 21:14:55.679Z

                                  Hi Nicolai! Yes it is working for me. You shouldn't get any errors message if you use onError: "Continue"
                                  What does the error message say?
                                  Here is the complete script I am using

                                  sf.ui.proTools.appActivateMainWindow();
                                  
                                  var channelName = sf.interaction.popupText({
                                      title: 'Channel name'
                                  }).text;
                                  
                                  function selectChannelName() {
                                      sf.ui.proTools.clipSelectFieldRecorderChannelOneClip({
                                          channelNameContains: [channelName.trim()],
                                          isOkayIfNoMatch: true, 
                                          onError: "Continue"
                                      })
                                  };
                                  
                                  sf.ui.proTools.clipDoForEachSelectedClip({action: selectChannelName});
                                  
                                  sf.keyboard.press ({keys: "alt+f"});
                                  
                                  1. NNicolai Linck @Nicolai_Linck7
                                      2023-01-13 08:41:48.292Z

                                      Hi Linus. Your code works!! I tried combining some code with yours but Its hard to read the coding when you have zero coding knowledge:) Thank you for sharing.

                                      1. NNicolai Linck @Nicolai_Linck7
                                          2023-01-24 10:17:30.562Z

                                          Hi Linus.
                                          Do you know if its possible to color code the clips that would stop the script, let say red, so it's easy to identify them?

                                          1. Linus Gidstedt @Linus_Gidstedt
                                              2023-01-24 22:16:58.421Z

                                              Interesting idea. I took a lock at it and came up with this:

                                              sf.ui.proTools.appActivateMainWindow();
                                              
                                              var channelName = sf.interaction.popupText({
                                                  title: 'Channel name'
                                              }).text;
                                              
                                              function selectChannelName() {
                                                  try{
                                                      sf.ui.proTools.clipSelectFieldRecorderChannelOneClip({
                                                          channelNameContains: [channelName.trim()],
                                                          isOkayIfNoMatch: true, 
                                                          onError: "ThrowError"
                                                      });
                                                  }catch (err) { 
                                                      sf.ui.proTools.colorsSelect({
                                                      colorTarget: "ClipsInTracks",
                                                      colorBrightness: "Light",
                                                      colorNumber: 8,
                                                      });
                                                  };
                                              };
                                              
                                              sf.ui.proTools.clipDoForEachSelectedClip({action: selectChannelName, onError: "Continue"});
                                              
                                              sf.keyboard.press({keys: "alt+f"});
                                              
                                              1. NNicolai Linck @Nicolai_Linck7
                                                  2023-01-26 09:39:39.873Z

                                                  Just what i had in mind. Thank you so much Linus!

                                      2. N
                                        Nicolai Linck @Nicolai_Linck7
                                          2023-02-15 12:57:50.474Z

                                          Hi again Linus.
                                          Im making a surface layout where i want the script to look for A3, A4..etc without the need for typing it in a text field. I have tried merging code from other scripts but it breaks the error handling. Is there a smart way to do it?

                                          Best Nicolai

                                          1. Linus Gidstedt @Linus_Gidstedt
                                              2023-02-15 16:15:33.776Z

                                              Hi! Just remove the popupText and change to channelNameContains: ["A3"], and duplicate the script and change to A4...etc. for all numbers you want.

                                              1. NNicolai Linck @Nicolai_Linck7
                                                  2023-02-16 09:40:46.881Z

                                                  Its breaking the error handling when im doing it. Do i need to replace the hole popup string or just some of the code?

                                                  var channelName = sf.interaction.popupText({
                                                      title: 'Channel name'
                                                  }).text;
                                                  

                                                  I have tried with this string but that also breaks the error handling:

                                                  var channelName = sf.ui.proTools.clipSelectFieldRecorderChannel({
                                                      channelNameContains: ['A3'],
                                                  });
                                                  

                                                  Best Nicolai

                                                  1. Linus Gidstedt @Linus_Gidstedt
                                                      2023-02-16 09:58:01.894Z

                                                      I'm sorry I wasn't clear enough. I mean like this:

                                                      sf.ui.proTools.appActivateMainWindow();
                                                      
                                                      function selectChannelName() {
                                                          try {
                                                              sf.ui.proTools.clipSelectFieldRecorderChannelOneClip({
                                                                  channelNameContains: ["A3"],
                                                                  isOkayIfNoMatch: true,
                                                                  onError: "ThrowError"
                                                              });
                                                          } catch (err) {
                                                              sf.ui.proTools.colorsSelect({
                                                                  colorTarget: "ClipsInTracks",
                                                                  colorType: "None"
                                                              });
                                                          };
                                                      };
                                                      
                                                      sf.ui.proTools.clipDoForEachSelectedClip({
                                                          action: selectChannelName, onError: "Continue"
                                                      });
                                                      
                                                      sf.keyboard.press({ keys: "alt+f" });
                                                      
                                                      1. NNicolai Linck @Nicolai_Linck7
                                                          2023-02-16 10:24:50.457Z

                                                          Ahh.. Of Course.. So simple. Sorry for the dumb questions and thanks for sharing!

                                                          1. Linus Gidstedt @Linus_Gidstedt
                                                              2023-02-16 10:26:36.608Z

                                                              No problem!😀