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
Linked from:
- SSoundFlow Bot @soundflowbot
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. - In reply toLinus_Gidstedt⬆:Christian Scheuer @chrscheuer2022-12-07 12:20:15.800Z
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.
Christian Scheuer @chrscheuer2022-12-07 12:20:57.375Z
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.
Linus Gidstedt @Linus_Gidstedt
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.
Christian Scheuer @chrscheuer2022-12-07 15:09:39.577Z
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)
Linus Gidstedt @Linus_Gidstedt
And I guess it's not possible to get a version of the source code of that script to play with?
Christian Scheuer @chrscheuer2022-12-07 17:23:27.020Z
There's no Javascript source code - it's an internal function.
Linus Gidstedt @Linus_Gidstedt
Ok got it!
- In reply tochrscheuer⬆:
Linus Gidstedt @Linus_Gidstedt
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()
?Christian Scheuer @chrscheuer2022-12-09 21:45:03.952Z
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
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.- NNicolai Linck @Nicolai_Linck7
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.
Linus Gidstedt @Linus_Gidstedt
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 usingsf.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"});
- NNicolai Linck @Nicolai_Linck7
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.
- In reply toLinus_Gidstedt⬆:NNicolai Linck @Nicolai_Linck7
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?Linus Gidstedt @Linus_Gidstedt
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"});
- NNicolai Linck @Nicolai_Linck7
Just what i had in mind. Thank you so much Linus!
- NIn reply toLinus_Gidstedt⬆:Nicolai Linck @Nicolai_Linck7
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
Linus Gidstedt @Linus_Gidstedt
Hi! Just remove the popupText and change to
channelNameContains: ["A3"],
and duplicate the script and change to A4...etc. for all numbers you want.- NNicolai Linck @Nicolai_Linck7
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
Linus Gidstedt @Linus_Gidstedt
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" });
- NNicolai Linck @Nicolai_Linck7
Ahh.. Of Course.. So simple. Sorry for the dumb questions and thanks for sharing!
Linus Gidstedt @Linus_Gidstedt
No problem!😀