Hey @raphaelsepulveda and @Chris_Shaw , I have taken your awesome script from here : Create new tracks and rename it with soundflow prompt typing manually and selecting words from a predefined lists and adpated it to make Loop Group cues. It's AWESOME! But now of course I want more. I'd like to have the user define String[] for certain groups. (Mainly for diffrent shows or movies if there's a recurring location.)
Unfortunatley when I try the below code it kicks back the following error on the second choice where the String[] is.
const locationNames = event.props.locationNames
///Naming function
const trackNameItems = {
instrument: [
"<NONE>",
"Ext Day",
"Ext Night",
"Int Day",
"Int Night",
"ENTER NAME",
],
location: [
"ENTER NAME",
"<NONE>",
locationNames,
]
section: [
"<NONE>",
"ENTER NAME",
"Beds",
"Bys",
"Callouts",
"Laughs",
"Claps",
"Breath",
"Fight Efforts",
],
suffix: [
"<NONE>",
"ENTER NAME",
"[R3]",
"Specific",
]
}
var selectedTrackNameItems = []
// Enter / select track name items
for (const i in trackNameItems) {
var selectedNameItem = sf.interaction.popupSearch({
title: `Select/Search/Enter ${i} name`,
items: trackNameItems[i].map(item => ({ name: item })),
onCancel: 'Abort',
}).item.name;
if (selectedNameItem == "<NONE>") selectedNameItem = "";
if (selectedNameItem == "ENTER NAME") {
selectedNameItem = sf.interaction.displayDialog({
title: `Name ${i}`,
prompt: `Enter ${i} name`,
defaultAnswer: `<${i}>`,
buttons: ["Cancel", "OK"],
defaultButton: "OK",
}).text
};
selectedTrackNameItems.push(selectedNameItem)
};
// Join all selectedTrackNameItems to create newTrackName
var newTrackName = selectedTrackNameItems.join(" ")
log(newTrackName)

Is there a workaround?
Bests,
Owen
Linked from:
- Chris Shaw @Chris_Shaw2021-12-09 18:18:28.820Z2021-12-09 18:29:36.178Z
You were missing a comma after the
location:
end bracket.You need to combine the
event.props
array with an array of default script choices using the.concat()
method shown below:const userLocationNames = ["Bedroom", "Garage"] //substitute this with your event.props const defaultLocations = ["ENTER NAME", "<NONE>"] //Combine user names with default names const locationChoices = defaultLocations.concat(userLocationNames) ///Naming function const trackNameItems = { instrument: [ "<NONE>", "Ext Day", "Ext Night", "Int Day", "Int Night", "ENTER NAME", ], location: locationChoices, section: [ "<NONE>", "ENTER NAME", "Beds", "Bys", "Callouts", "Laughs", "Claps", "Breath", "Fight Efforts", ], suffix: [ "<NONE>", "ENTER NAME", "[R3]", "Specific", ] } var selectedTrackNameItems = [] // Enter / select track name items for (const i in trackNameItems) { var selectedNameItem = sf.interaction.popupSearch({ title: `Select/Search/Enter ${i} name`, items: trackNameItems[i].map(item => ({ name: item })), onCancel: 'Abort', }).item.name; if (selectedNameItem == "<NONE>") selectedNameItem = ""; if (selectedNameItem == "ENTER NAME") { selectedNameItem = sf.interaction.displayDialog({ title: `Name ${i}`, prompt: `Enter ${i} name`, defaultAnswer: `<${i}>`, buttons: ["Cancel", "OK"], defaultButton: "OK", }).text }; selectedTrackNameItems.push(selectedNameItem) }; // Join all selectedTrackNameItems to create newTrackName var newTrackName = selectedTrackNameItems.join(" ") log(newTrackName)
Chris Shaw @Chris_Shaw2021-12-09 18:23:29.057Z
Using this method you could customize all of the naming choices with templates and
event.props
- OOwen Granich-Young @Owen_Granich_Young
Yep already thinking now I should problably just do that 😂
- OOwen Granich-Young @Owen_Granich_Young
😃😃😃
- In reply toChris_Shaw⬆:OOwen Granich-Young @Owen_Granich_Young
Doh!
Thanks man! Perfection as always!
bests,
Owen - In reply toChris_Shaw⬆:OOwen Granich-Young @Owen_Granich_Young
One more quesiton if you're willing. How would I make it so you can toggle on or off any of the name secitons? So if i didn't need suffix I could have it templated to toggle off and have one less menu to jump through?
Chris Shaw @Chris_Shaw2021-12-09 19:46:10.563Z
I'll have this for you in a bit.
Having a computer problem at the moment.- OOwen Granich-Young @Owen_Granich_Young
Bruh take all the time you need, you are a boss!
Chris Shaw @Chris_Shaw2021-12-09 19:51:56.420Z
it will require very specific naming of the template props to work.
- OOwen Granich-Young @Owen_Granich_Young
Current props names
const userPrefix = event.props.prefixText const userlocationNames = event.props.locationNames const useractionText = event.props.actionText const usersuffixText = event.props.suffixText const defaultChoices = ["ENTER NAME", "<NONE>"] const prefixChoices = defaultChoices.concat(userPrefix) const locationChoices = defaultChoices.concat(userlocationNames) const actionChoices = defaultChoices.concat(useractionText) const suffixChoices = defaultChoices.concat(usersuffixText)
- In reply toChris_Shaw⬆:
Chris Shaw @Chris_Shaw2021-12-09 20:17:50.999Z2021-12-09 20:40:01.634Z
To make presets that skips naming steps you need to create booleans in your template whose property names begin with the names of the properties in
trackNameItems
like so:instrumentNamingSkip
locationNamingSkip
sectionNamingSkip
suffixNamingSkip
Which will give you a preset that looks something like this:
In the
for (const i in trackNameItems)
loop,i
returns the current name of the property intrackNameItems
.The next line of code combines the property name with
"NamingSkip"
which in turn will return theevent.prop
with that combined name (ex.sectionNamingSkip
). If that returns returnsfalse
then that naming step will be skipped:if (event.props[i + "NamingSkip"] != false)
Here's the new code:
const userLocationNames = ["Bedroom", "Garage"] //substitute this with your event.props const defaultLocations = ["ENTER NAME", "<NONE>"] //Combine user names with default names const locationChoices = defaultLocations.concat(userLocationNames) ///Naming function const trackNameItems = { instrument: [ "<NONE>", "Ext Day", "Ext Night", "Int Day", "Int Night", "ENTER NAME", ], location: locationChoices, section: [ "<NONE>", "ENTER NAME", "Beds", "Bys", "Callouts", "Laughs", "Claps", "Breath", "Fight Efforts", ], suffix: [ "<NONE>", "ENTER NAME", "[R3]", "Specific", ] } var selectedTrackNameItems = [] // Enter / select track name items for (const i in trackNameItems) { if (event.props[i + "NamingSkip"] == false) { var selectedNameItem = sf.interaction.popupSearch({ title: `Select/Search/Enter ${i} name`, items: trackNameItems[i].map(item => ({ name: item })), onCancel: 'Abort', }).item.name; if (selectedNameItem == "<NONE>") selectedNameItem = ""; if (selectedNameItem == "ENTER NAME") { selectedNameItem = sf.interaction.displayDialog({ title: `Name ${i}`, prompt: `Enter ${i} name`, defaultAnswer: `<${i}>`, buttons: ["Cancel", "OK"], defaultButton: "OK", }).text }; selectedTrackNameItems.push(selectedNameItem) } }; // Join all selectedTrackNameItems to create newTrackName var newTrackName = selectedTrackNameItems.join(" ") log(newTrackName)
- OOwen Granich-Young @Owen_Granich_Young
🤯🤯🤯 Oh man what waters have I wandered into. Thanks for spelling it out gonna give it a try!
- OOwen Granich-Young @Owen_Granich_Young
So if I'm reading correclty the Boolean's need to reference these names exaclty correct?
IE: prefix | location | action | suffix
- OOwen Granich-Young @Owen_Granich_Young
or to be EXACT :
prefixNamingSkip locationNamingSkip actionNamingSkip suffixNamingSkip
Chris Shaw @Chris_Shaw2021-12-09 20:33:35.113Z2021-12-09 20:47:39.813Z
.
- In reply toOwen_Granich_Young⬆:
Chris Shaw @Chris_Shaw2021-12-09 20:32:55.233Z2021-12-09 20:46:40.990Z
[EDIT: ignore this as wel!!]
In your case the booleans should be named:
prefixNamingSkip
locationChoicesNamingSkip
actionNamingSkip
suffixNamingSkip
- OOwen Granich-Young @Owen_Granich_Young
Why the one
locationChoicesNamingSkip
is Choices and the others are not in your list? Sorry if it's obvious...The other's then shouldn't be
prefixChoicesNamingSkip actionChoicesNamingSkip suffixChoicesNamingSkip
Chris Shaw @Chris_Shaw2021-12-09 20:43:01.150Z
My bad (again 🤦♂️)
it should be
prefixNamingChoicesSkip
locationChoicesNamingSkip
actionChoicesNamingSkip
suffixChoicesNamingSkip
(That'll teach me not code before three cups of coffee)
- OOwen Granich-Young @Owen_Granich_Young
It actually worked the other way instead interstingly enough. The
locationChoicesNamingSkip
did not work but the other 3 did so I swapped that one to match the others and it was good.🤷🏽♂️🤷🏽♂️🤷🏽♂️
- In reply toChris_Shaw⬆:
Chris Shaw @Chris_Shaw2021-12-09 20:25:31.507Z
Oops! some of the pics were displaying the incorrect names.
Corrected now - In reply toChris_Shaw⬆:
Chris Shaw @Chris_Shaw2021-12-09 20:29:15.632Z2021-12-09 20:41:27.178Z
[ EDIT: IGNORE THIS!!!!! ]
if (event.props[i + "NamingSkip"] != false)
could also be rewritten as
(if (event.props[i + "NamingSkip"])
- OOwen Granich-Young @Owen_Granich_Young
Does it matter one way or the other?
Chris Shaw @Chris_Shaw2021-12-09 20:40:57.045Z
🤦♂️🤦♂️🤦♂️
Ughhh!
It does!
My bad.Also the code isn't quite right I've posted the new code above
Chris Shaw @Chris_Shaw2021-12-09 20:43:58.930Z
Hopefully that should be the end of my mistakes 🤣
- In reply toChris_Shaw⬆:OOwen Granich-Young @Owen_Granich_Young
hahah I'm getting that! They're inverted right now! LOL checking above code. And I figured out above note too, location one should match the others!
Chris Shaw @Chris_Shaw2021-12-09 20:51:43.022Z
Be sure to post you completed code when you got it working. The above thread will be confusing to follow :)
Chris Shaw @Chris_Shaw2021-12-09 20:52:08.537Z
(no thanks to me 🤪)
Chris Shaw @Chris_Shaw2021-12-09 20:55:19.214Z
yYou might want to consider renaming
action: useractionText
toaction: actionChoices
for consistency- OOwen Granich-Young @Owen_Granich_Young
Oh yeah And I messed up too! That one doesn't have the combined correct!
- In reply toChris_Shaw⬆:OOwen Granich-Young @Owen_Granich_Young
It's all working!
Final code :
const userPrefix = event.props.prefixText const userlocationNames = event.props.locationNames const useractionText = event.props.actionText const usersuffixText = event.props.suffixText const defaultChoices = ["ENTER NAME", "<NONE>"] const prefixChoices = defaultChoices.concat(userPrefix) const locationChoices = defaultChoices.concat(userlocationNames) const actionChoices = defaultChoices.concat(useractionText) const suffixChoices = defaultChoices.concat(usersuffixText) ///const suffixToggle = false ///Naming function const trackNameItems = { prefix: prefixChoices, location: locationChoices, action: actionChoices, suffix: suffixChoices, } var selectedTrackNameItems = [] // Enter / select track name items for (const i in trackNameItems) { if (event.props[i + "NamingSkip"] == false) { var selectedNameItem = sf.interaction.popupSearch({ title: `Select/Search/Enter ${i} name`, items: trackNameItems[i].map(item => ({ name: item })), onCancel: 'Abort', }).item.name; if (selectedNameItem == "<NONE>") selectedNameItem = ""; if (selectedNameItem == "ENTER NAME") { selectedNameItem = sf.interaction.displayDialog({ title: `Name ${i}`, prompt: `Enter ${i} name`, defaultAnswer: `<${i}>`, buttons: ["Cancel", "OK"], defaultButton: "OK", }).text }; selectedTrackNameItems.push(selectedNameItem) } }; // Join all selectedTrackNameItems to create newTrackName var newTrackName = selectedTrackNameItems.join(" ") log(newTrackName)
Final Boleans:
I then use this to create Region groups for group cuing, full package in the store 'ADR CUE Creator'
Thanks for all your help Chris!
Of course I've gotten one more idea into my head to have the option of a FIXED text for any field as yet a third option... (very useful if it's one character you're cuing FS for for example, over a series of changing surfaces.) You've already done so much and adding yet another variable seems daunting 😂😂😂... but if you're bored 😃
You are a rockstar bud!