Skip navigation
Currently Being Moderated

InDesign: activeDocument.Pages.itemByRange(ini,end) --> What type? Methods?

Jul 18, 2011 12:49 PM

[Writing extensions in Flash Builder 4 with Creative Suite SDK, without extension Builder]

 

 

Hi,

 

I'd love to have access to elements in a page range, say, for example, the TextFrames in pages from 5 to 10 in a 20 pages document.

 

The element returned by "itemByRange()" method of the Pages element within the active document, is of type "Object" (according to the documentation), or, more exactly, a "CSHostObject".

 

How do I use this element??

 

Are they pages? If so, why can't I access all of their properties or methods?

 

I've been trying to do it for four days, now, to no avail.

 

If I write:

 

 

var pagesRange     : Object     = InDesign.app.activeDocument.Pages.itemByRange(ini, end)

 

I get a CSHostObject that I cannot use for anything.

 

Any ideas?

 

Thanks guys.

 

PS. Sorry if this seems basic, but iI'm just learning to use the inDesign DOM and find it a little dificult to use from ActionScript.

 
Replies
  • Currently Being Moderated
    Jul 18, 2011 8:25 PM   in reply to JoseAjáAjá

    Hi,
    I tested below function to check return what kind of Object.

     

    <?xml version="1.0" encoding="utf-8"?>

     

    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" historyManagementEnabled="false">

     

        <mx:Script>
            <![CDATA[
                import com.adobe.csawlib.indesign.InDesign;
                import com.adobe.indesign.*;
               
            public static function run():void
            {
                var app:Application = InDesign.app;
                var document:com.adobe.indesign.Document = app.activeDocument
                var pg:Object = document.pages.itemByRange(1,2);
                document.pages.item(0).textFrames.item(0).contents = pg+"";
            }
            ]]>
        </mx:Script>
        <mx:Button label="Run ID code" click="run()" />
    </mx:Application>

     

     

    and I got [object Page], itemByRange method returns Page Object.

    next, I wrote below mxml file,

     

     

    <?xml version="1.0" encoding="utf-8"?>

     

    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" historyManagementEnabled="false">

     

        <mx:Script>
            <![CDATA[
                import com.adobe.csawlib.indesign.InDesign;
                import com.adobe.indesign.*;
               
                public static function run():void
                {
                    var app:com.adobe.indesign.Application = InDesign.app;
                    var document:Document = app.activeDocument;
                    var pg:Object = document.pages.itemByRange(0,2);
                    var str:String = pg.documentOffset +"";
                    document.pages.item(0).textFrames.item(0).contents = str ;
                }
            ]]>
        </mx:Script>
        <mx:Button label="Run ID code" click="run()" />
    </mx:Application>

     

    "documentOffset" is Page Objects property, and I got an Array like below image.

     

    getArray.png

     

    I just learning CSSDK too. And I think Its poor informations hindrance to understanding.

     

    Ten

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (1)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points