3 Replies Latest reply on Jun 30, 2015 9:55 AM by rob day

    Convert this CS4 to CS5 Script

    Foxy Ford Level 1

      Can anyone help to this script?

       

      I´ts a Caption Script for Indesign CS4. So I need to convert it to CS5 and create a new script to Credit Photo.

      I need a Script Caption and another Script Credit.

       

       

      if (app.selection.length == 1 || app.selection [0] .constructor.name! = "Retângulo")
        Saída ();

      var MyPicture = app.selection [0];

      var = gb myPicture.geometricBounds;

      // Adicionar uma moldura para a matriz da imagem, que é uma Página

      var myCaption myPicture.parent.textFrames.add = ();

      // Posição eo tamanho da legenda definido

      myCaption.geometricBounds = [gb [2], gb [1], AR [2] 14, gb [3]];

      // Aplicar estilo de objeto para a rubrica - nós assumir que é presente

      myCaption.applyObjectStyle (app.activeDocument.objectStyles.item ("caput"));

      // Adicionar conteúdo espaço reservado

      myCaption.contents = "Caption";

      // Grupo a imagem ea legenda

      myPicture.parent.groups.add ([MyPicture, myCaption]);

        • 1. Re: Convert this CS4 to CS5 Script
          rob day Adobe Community Professional & MVP

          This line seems like it would create a problem in any version:

           

          myCaption.geometricBounds = [gb [2], gb [1], AR [2] 14, gb [3]];

           

          There's a reference to an array AR that isn't in the script.

           

          I would think it would be something like this:

          myCaption.geometricBounds = [gb [3], gb [1], gb [3] + 14, gb [4]];

           

          gb [3] is the bottom y coordinate of the picture box

          gb [1] is the left x of the picture box

          gb [3] + some amount gives the caption's depth. It would be ruler units so keep in mind 14 could be inches

          gb [4] is the right x of the picture box

           

          The script also expects an object style named caput to be in the doc.

          • 2. Re: Convert this CS4 to CS5 Script
            Foxy Ford Level 1

            I will try this afternoon!

             

            Will be this line to Credit Image or to Caption Image?

            • 3. Re: Convert this CS4 to CS5 Script
              rob day Adobe Community Professional & MVP

              Will be this line to Credit Image or to Caption Image?

              Is there more to the script than what you posted?

               

              Looking more closely there are other problems

               

              var = gb myPicture.geometricBounds;

              should be:

              var gb=myPicture.geometricBounds;

               

              var myCaption myPicture.parent.textFrames.add = ();

              should be with add parameters:

              var myCaption=myPicture.parent.textFrames.add();

               

              I don't think this is a version problem—you might ask over in the scripting forum.