0 Replies Latest reply on Oct 20, 2010 6:10 AM by ST dishon

    Anchoring groups CS3 JS

    ST dishon

      I have written basic code to create a graphic frame and text frame for captions. I have grouped them. I am now missing code for anchoring it in place of caption.

       


      for(i = myResults.length-1; i >=0 ; i-- )
          {
       
      //create picture frame and apply object style
        var myPhotoFrame=myPage.rectangles.add({geometricBounds:["0","108","40", "0"]})
        var myO1style=app.activeDocument.objectStyles.itemByName("photos");
        myPhotoFrame.applyObjectStyle(myO1style)
       
        var myAnchoredText=myResults[i].texts.itemByRange(myResults[i].characters[0], myResults[i].characters[-2])
        alert(myAnchoredText.contents)

       

      //create text frame and apply object style
        var myTextFrame=myPage.textFrames.add({geometricBounds:["0","108","10","0"]})
        var myO2style=app.activeDocument.objectStyles.itemByName("captions");
        myTextFrame.applyObjectStyle(myO2style)

      //move captions into text frames
        myTextFrame.contents=""+myAnchoredText.contents+""
        myAnchoredText.remove()

      //Group
         var myArray = new Array;
         myArray.push(myPhotoFrame);
        myArray.push(myTextFrame);

      //Group the items.
        var myGroup =myPage.groups.add(myArray);

      //anchor 
         myInsertionPoint = myResults[i].insertionPoints.item(-1)  

       

      last line of script not acceptable!!

      Thanx

      STdishon.