1 Reply Latest reply on Oct 31, 2014 12:32 PM by im.thatoneguy

    Looking for code samples: Loop through selected seqs, resize and create seq from clip

    im.thatoneguy Level 1

      Are there any code samples for handling three situations:

       

      1) Looping through selected Sequences in the bin.  (Simple rename script example ala:   For (s in sequences) {if (s.selected == true) {s.name = s.name + "_suffix";}}

       

      2) Changing the resolution of a sequence.

       

      s = bin.sequences["bob_01"];

      s.format.width = 1920;

      s.format.height = 1080;

       

      3) Creating a sequence from clip
      c = bin.clips["bob_01.mov"];

      seq = createSequenceFromClip(c);

        • 1. Re: Looking for code samples: Loop through selected seqs, resize and create seq from clip
          im.thatoneguy Level 1

          Ok, I'm making progress.  I have a recursive fumction that seems to be crashing though:

           

           

          function walkBin(root)
          {
             
              for (i = 0; i < root.children.numItems; i++)
              {
                  if (root.children[i].type == 2 || root.children[i].type == 3) //bin
                  {
                      walkBin(root.children[i]);
                      alert("Bin \'" + app.project.rootItem.children[i].name+ "\" with " + " " + app.project.rootItem.children[i].children.numItems + " children");
                  }
                  else if (root.children[i].type == 1)
                  {
                      alert ("Clip: " + root.children[i].name );
                  }
                  else if (root.children[i].type == 4)
                  {
                      alert ("File: " + root.children[i].name);
                  }
              }
              return "finished loop";
          }
          
          
          walkBin(app.project.rootItem);
          

           

          Also is there no distinguishing between clips and sequences?  Is it possible to add clips to a sequence?  Lastly how do you convert a sequence from the bin into one of the sequences in project.sequences?