No internet connection
  1. Home
  2. How to

Variation on naming for EDICUE ADR cue creation.

By Owen Granich-Young @Owen_Granich_Young
    2021-12-13 18:38:42.323Z

    Hi @Chris_Shaw,

    I'm looking to itterate on this previous naming script you helped me with Is there a way to make a String array work with this script? #post-29 to make a ADR cue creator for EdiCue.

    Basically I have a couple questions I'm hoping you can help me with on tweaking what the variables of the created naming codes do. - Jump past the picture to ignore preamble and get to my actual questions :P

    A little history, Edicue https://www.soundsinsync.com/products/edicue is (more or less) the industry standard for ADR cue sheets for feature film and televison. The program works by the user creating clipgroups on specifically named tracks with a series of parameters that is then output as a 'Session info as Text...' which edicue reads to make very elgant cue sheets.

    Here's an example of how ADR cues are logged into the clip group from their .pdf

    JUMP TO HERE TO IGNORE ALL THE PREAMBLE :

    Question 1 : I'd like to know if there's an easy way for me to code the Dropdown list of choices to say one thing but the final output to be another. The REASON catagory in the drop down menu I'd like it to have both the written out reason and the [Rxx] number - For example Clarity [R1] -- Noise [R2] -- etc, etc However when your choice is made it only appends the [Rxx] to your name. I'd do the same logic with the Priorty [Px] numbers.

    Question 2 : The NOTES aspect is always braceted by { } in edicue naming conventions how could I tell the naming section of a specfic area to always add those to the outside of whatever text was typed/chosen? So while I might write - Director wants more forceful performance - the final output would be {Director wants more forceful performance}

    Question 3 : (Kind of a dooozy lower importance but would be cool) The final set of choices - [BV] [TBW] [SW] [SO] [ED] [AP] can all be added if desired in the program and represent differnt info tages, how would I write a naming section that loops choices and continues to append until the user says 'ok move on' . So I could select [BV] then it would ask again 'anything else from the list?' and I could select [TBW] and it would ask 'anything else from the list?' and I could select and it moves on to create the name.

    Thanks!
    Owen

    • 15 replies

    There are 15 replies. Estimated reading time: 22 minutes

    1. O

      Current Code for references if desired.

      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)
      
      sf.ui.proTools.appActivateMainWindow();
      sf.ui.proTools.invalidate();
      globalState.previouslySelectedTrackNames = sf.ui.proTools.selectedTrackNames;
      
      ///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)
      
      /// Scroll to track
      // Selects the track based on the name you've entered
      // Remove trailing ' - Audio Track' from track title to get track name
      
      const t = characterTrack.title.Value
      var slicedName = t.slice(0,t.indexOf(" - Audio Track"))
      
      sf.ui.proTools.trackGetByName({ name: slicedName, makeVisible: true }).track.trackSelect();
      
      /// Re-focus Protools window
      sf.ui.proTools.appActivateMainWindow();
      sf.ui.proTools.invalidate();
      
      /// Creates and names the group
      sf.ui.proTools.menuClick({
          menuPath: ["Clip","Group"],
      });
      
      sf.ui.proTools.menuClick({
          menuPath: ["Clip","Rename..."],
      });
      
      sf.ui.proTools.windows.whoseTitle.is("Name").first.groups.whoseTitle.is("Name").first.textFields.whoseTitle.is("").first.elementSetTextFieldWithAreaValue({
          value: newTrackName,
      });
      
      sf.ui.proTools.windows.whoseTitle.is("Name").first.buttons.whoseTitle.is("OK").first.elementClick();
      
      /// Returns to previously selected track
      sf.ui.proTools.trackSelectByName({ names: globalState.previouslySelectedTrackNames, deselectOthers: true });
      
      
      1. Are you looking to do this as an added feature to the above script or as a new script?

        1. This might get you closer to what you're looking for.

          const reasonsList = [
              "[R1] = Clarity",
              "[R2] = Noise",
              "[R3] = Traffic",
              "[R4] = Distortion",
              "[R5] = Low Level"
          ];
          
          
          var selectedReason = sf.interaction.popupSearch({
              title: `Select reason`,
              items: reasonsList.map(item => ({ name: item })),
              onCancel: 'Abort',
          }).item.name;
          
          var reasonAppendix = selectedReason.split(" = ")[0]
          
          var notes = sf.interaction.displayDialog({
              title: "Notes",
              prompt: "Enter notes:",
              defaultAnswer: "<Enter notes here>"
          }).text
          
          
          var moreTags = sf.interaction.selectFromList({
              allowMultipleSelections: true,
              prompt: "Select additional tags\n (Use cmd-click)\n (Drag bottom right  corner to see more choices",
              title: "Additional Tags",
              items: [
                  "[BV]",
                  "[TBW]",
                  "[SW]",
                  "[SO]",
                  "[ED]",
                  "[AP]"
              ]
          }).list
          
          
          var additionalChoices = moreTags.join("")
          
          
          log(`${reasonAppendix}{${notes}}${additionalChoices}`)
          1. Whoa, cool!

            I think I need kind of a combination of this inside your orignal naming script.

            const reasonsList = [
                "[R1] = Clarity",
                "[R2] = Noise",
                "[R3] = Traffic",
                "[R4] = Distortion",
                "[R5] = Low Level"
            ];
            
            
            var selectedReason = sf.interaction.popupSearch({
                title: `Select reason`,
                items: reasonsList.map(item => ({ name: item })),
                onCancel: 'Abort',
            }).item.name;
            
            var reasonAppendix = selectedReason.split(" = ")[0]
            

            This part is perfect as is, just has to go at the end I'm sure I can figure that out. Can also be duplcated for Priority. I get the split at = is the way to define it ( If I wanted to have user have option of typing there own I'd use a concat here again right?)

                title: "Notes",
                prompt: "Enter notes:",
                defaultAnswer: ""
            }).text
            

            Notes Section I'd like to be able to skip if enter is pressed, as we don't always have notes if default text is made to nothing just pressing enter to skip the step would work right?

            var moreTags = sf.interaction.selectFromList({
                allowMultipleSelections: true,
                prompt: "Select additional tags\n (Use cmd-click)\n (Drag bottom right  corner to see more choices",
                title: "Additional Tags",
                items: [
                    "[BV]",
                    "[TBW]",
                    "[SW]",
                    "[SO]",
                    "[ED]",
                    "[AP]"
                ]
            }).list
            

            This is super cool! However, I'd like to be able to press enter without selecting any additional Tags as well? Currently you must select one.

            And at the end of the script is var additionalChoices = moreTags.join("") just a join of the var moreTags section not the whole thing correct?

            How do I take these variable 'modules' you've created and then cram them into your previous script to end with the same final

            var newTrackName = selectedTrackNameItems.join(" ") that I can then run the rest of the script with?

            Does that remotley make sense?

            Thanks again for all your help!
            Owen

            1. I THINK after sleeping on this and looking at the two scripts again this morning I can figure out how to merge them and make a new final var newTrackName

              I have to actually do my job today, so I can't dive into it yet. But when I can I'll make an attempt and probably ask you to tell me where I'm going wrong.

              Thanks!
              Owen

              1. OOwen Granich-Young @Owen_Granich_Young
                  2021-12-16 00:05:21.244Z2021-12-16 00:19:43.341Z

                  Ok so I did combine them, then decided it was overkill and just adjusted your new script to add some lines. Full code at the bottom of this post, but questions first.

                  var moreTags = sf.interaction.selectFromList({
                      allowMultipleSelections: true,
                      prompt: "Select additional tags\n (Use cmd-click)\n (Drag bottom right  corner to see more choices",
                      title: "Additional Tags",
                      items: [
                          "[BV]",
                          "[TBW]",
                          "[SW]",
                          "[SO]",
                          "[ED]",
                          "[AP]"
                      ]
                  }).list
                  

                  Question 1 : How do I make it so pressing ENTER when this window appears skips this step? Curently I have to select SOMETHING. I made a blank one to select but that simply means I still have to mouse over and click on it first (TOO SLOW).

                  Quesiton 2: I still don't totally understand how to implement the Boolean outside of how it worked in the previous script - How would I code an on off switch for any of the sections similar to the other script. I'd like to have on off switches for the

                  /// Notes
                  /// Reason
                  /// Priority
                  /// More Tags
                  

                  Sections.

                  Below is the current final code, working like gangbusters. Thanks again for all your help, really feel like I've been ever so slowly beginning to grasp this all. Even if I have to ask to be shown everything the first time.

                  const characterTrack = event.props.characterTrack;
                  const reasonsList = [
                      "[R1] = Clarity",
                      "[R2] = Noise",
                      "[R3] = Traffic",
                      "[R4] = Distortion",
                      "[R5] = Low Level",
                      "[R6] = Off-mic",
                      "[R7] = Overlap",
                      "[R8] = Sound Edit",
                      "[R9] = Continuity",
                      "[R10] = New Line",
                      "[R11] = Line Change",
                      "[R12] = Alt Version",
                      "[R13] = Temp",
                      "[R14] = Mute",
                      "[R15] = Perform",
                      "[R16] = Accent",
                      "[R17] = Swear Coverage",
                      "[R18] = TV Version",
                      "[R19] = Arline Version",
                  ];
                  const priorityList = [
                      "[P1] = Priority 1",
                      "[P2] = Priority 2",
                      "[P3] = Priority 3",
                      "[P4] = Priority 4",
                      "[P5] = Priority 5",
                      "[P6] = Priority 6",
                      "[P7] = Priority 7",
                      "[P8] = Priority 8",
                      "[P9] = Priority 9",
                  ];
                  
                  sf.ui.proTools.appActivateMainWindow();
                  sf.ui.proTools.invalidate();
                  globalState.previouslySelectedTrackNames = sf.ui.proTools.selectedTrackNames;
                  
                  
                  /// Line
                  var line = sf.interaction.displayDialog({
                      title: "Line",
                      prompt: "Enter Line",
                      defaultAnswer: "Fight Efforts"
                  }).text
                  
                  /// Notes
                  var notes = sf.interaction.displayDialog({
                      title: "Notes",
                      prompt: "Enter notes:",
                      defaultAnswer: ""
                  }).text
                  
                  
                  /// Reason
                  var selectedReason = sf.interaction.popupSearch({
                      title: `Select reason`,
                      items: reasonsList.map(item => ({ name: item })),
                      onCancel: 'Abort',
                  }).item.name;
                  
                  var reasonAppendix = selectedReason.split(" = ")[0]
                  
                  /// Priority
                  
                  var selectedPriority = sf.interaction.popupSearch({
                      title: `Select reason`,
                      items: priorityList.map(item => ({ name: item })),
                      onCancel: 'Abort',
                  }).item.name;
                  
                  var priorityAppendix = selectedPriority.split(" = ")[0]
                  
                  /// More Tags
                  
                  var moreTags = sf.interaction.selectFromList({
                      allowMultipleSelections: true,
                      prompt: "Select additional tags\n (Use cmd-click)\n (Drag bottom right  corner to see more choices",
                      title: "Additional Tags",
                      items: [
                          "[BV]",
                          "[TBW]",
                          "[SW]",
                          "[SO]",
                          "[ED]",
                          "[AP]"
                      ]
                  }).list
                  
                  /// Join more tags
                  var additionalChoices = moreTags.join("")
                  
                  /// log it ALL
                  log(`${line}{${notes}}${priorityAppendix}${reasonAppendix}${additionalChoices}`)
                  
                  var finalAdrText = `${line}{${notes}}${priorityAppendix}${reasonAppendix}${additionalChoices}`
                  
                  /// Scroll to track
                  // Selects the track based on the name you've entered
                  // Remove trailing ' - Audio Track' from track title to get track name
                  
                  const t = characterTrack.title.Value
                  var slicedName = t.slice(0, t.indexOf(" - Audio Track"))
                  
                  sf.ui.proTools.trackGetByName({ name: slicedName, makeVisible: true }).track.trackSelect();
                  
                  /// Re-focus Protools window
                  sf.ui.proTools.appActivateMainWindow();
                  sf.ui.proTools.invalidate();
                  
                  /// Creates and names the group
                  sf.ui.proTools.menuClick({
                      menuPath: ["Clip", "Group"],
                  });
                  
                  sf.ui.proTools.menuClick({
                      menuPath: ["Clip", "Rename..."],
                  });
                  
                  sf.ui.proTools.windows.whoseTitle.is("Name").first.groups.whoseTitle.is("Name").first.textFields.whoseTitle.is("").first.elementSetTextFieldWithAreaValue({
                      value: finalAdrText,
                  });
                  
                  sf.ui.proTools.windows.whoseTitle.is("Name").first.buttons.whoseTitle.is("OK").first.elementClick();
                  
                  /// Returns to previously selected track
                  sf.ui.proTools.trackSelectByName({ names: globalState.previouslySelectedTrackNames, deselectOthers: true });
                  
                  

                  Bests,
                  Owen

            2. In reply toChris_Shaw:

              ACK sorry I missed this when you asked!

              1. Dustin Harris @Dustin_Harris
                  2021-12-17 21:14:00.422Z

                  Hi Owen,
                  if you want to be able to click ok on your additional tags list without selecting any, you can use this code:

                  var moreTags = sf.interaction.selectFromList({
                      allowMultipleSelections: true,
                      prompt: "Select additional tags\n (Use cmd-click)\n (Drag bottom right  corner to see more choices",
                      title: "Additional Tags",
                      items: [
                          "[BV]",
                          "[TBW]",
                          "[SW]",
                          "[SO]",
                          "[ED]",
                          "[AP]"
                      ],
                      allowEmptySelection: true
                  }).list
                  

                  also, I'm doing something similar to your reasonsList, but I do it as an object by returning the value from the selected key name (reason). Not that what you're doing is wrong or bad or anything, this is just another way of accomplishing the same thing if it makes your script easier :)

                  const reasonsList = {
                      "Clarity" : "[R1]",
                       "Noise" : "[R2]",
                      "Traffic" : "[R3]",
                      "Distortion" : "[R4]",
                      "Low Level" : "[R5]",
                      "Off-mic" : "[R6]",
                      "Overlap" : "[R7]",
                      "Sound Edit" : "[R8]",
                      "Continuity" : "[R9]",
                      "New Line" : "[R10]",
                      "Line Change" : "[R11]",
                      "Alt Version" : "[R12]",
                      "Temp" : "[R13]",
                      "Mute" : "[R14]",
                      "Perform" : "[R15]",
                      "Accent" : "[R16]",
                      "Swear Coverage" : "[R17]",
                      "TV Version" : "[R18]",
                      "Arline Version" : "[R19]",
                  };
                  
                  
                  /// Reason
                  var selectedReason = reasonsList[sf.interaction.popupSearch({
                      title: `Select reason`,
                      items: Object.keys(reasonsList).map(item => ({ name: item })),
                      onCancel: 'Abort',
                  }).item.name]
                  
                  log(selectedReason)
                  
                  1. Thanks Dustin!

                    1. Hey @Dustin_Harris this works however I can't press enter in order to skip it, I think it's becuase the window is not focused? I can click anywhere in the window then press enter, how would I tell it to focus the Addtional tags window?

                      I tried pick ui element from macro to focus it but Soundflow DID NOT like that.

                      Bests,
                      Owen

                      1. Dustin Harris @Dustin_Harris
                          2021-12-17 23:57:31.332Z

                          Yeah, the pop up menu is based on applescript in the OS I think, so it’s not the focused program by default, and I haven’t figured out how to focus it automatically. @kitch is this still the case?

                          1. Kitch Membery @Kitch2021-12-18 00:03:14.429Z

                            Hi @Dustin_Harris and @Owen_Granich_Young,

                            I can unfortunately confirm this is still the case with the sf.interaction.selectFromList() method.

                            I believe the bug has been reported. :-)

                            Rock on!

                            1. Copy that thanks guys. I guess I'll leave it in the script for the store for now but delete it in my own copy. Too slow to have to mouse in every time I want to use these, when TBH I don't use them that much.

                • J
                  jeff Fuller @jeff_Fuller
                    2022-07-01 18:58:24.532Z

                    I cant get this to run right.

                    1. Hey Jeff,
                      Looks like you're using the downloaded package.

                      When you created your preset for the specific character did you make sure to select the 'Character Track' in the preset?

                      Seems like that is undefined from the the error I'm seeing. It should be a searchable bar that looks at your current session, pick an existing character track from that.