Quantcast
Channel: Adobe Community : Popular Discussions - InDesign Scripting
Viewing all articles
Browse latest Browse all 15932

Getting the correct page number

$
0
0

Hi, Im stuck with this project...

 

I have this xml tag

<page id="p4" type="cyan">some content</page>

 

so, what I want to do is, use this attributes to apply a B-Cyan, B-Magenta or B-Yellow master spread to

(well to whatever page number there is on the tag) in this case page 4 (and 5 implicitly)

 

 

im stuck here

 

 

if( !myRoot.xmlAttributes.itemByName("xmlns:xml").isValid )

myRoot.xmlAttributes.add( "xmlns:xml", "http://www.w3.org/XML/1998/namespace" );

if( !myRoot.xmlAttributes.itemByName("xmlns:aid").isValid )

myRoot.xmlAttributes.add( "xmlns:aid", "http://ns.adobe.com/Adobe InDesign/4.0/" );

if( !myRoot.xmlAttributes.itemByName("xmlns:aid5").isValid )

myRoot.xmlAttributes.add( "xmlns:aid", "http://ns.adobe.com/Adobe InDesign/5.0/" );

//

//**Types of pages

var myPageNode= myRoot.evaluateXPathExpression("//page");

 

 

for (var x = 0; x < myPageNode.length; x++){

 

                    var pageNumber  =  myPageNode[x].xmlAttributes.itemByName("id").value.replace("p","").replace(" ","");

                    var myTypeOfPage = myPageNode[x].xmlAttributes.itemByName("type").value;

 

                    if (myTypeOfPage = "cyan"){

                         app.activeDocument.pages.itemByName().appliedMaster = app.activeDocument.masterSpreads.item("B-Cyan")

                                                }

                    if (myTypeOfPage = "magenta"){

                        app.activeDocument.pages.itemByName().appliedMaster = app.activeDocument.masterSpreads.item("B-Magenta")

                        }

                    if (myTypeOfPage = "yellow"){

                        app.activeDocument.pages.itemByName().appliedMaster = app.activeDocument.masterSpreads.item("B-Yellow")

                        }

                    };

 

 

i dont know how to pass the correct value to: pages.itemByName( my page tag id number should get here )

 

 

help!!!!!!!!!!!


Viewing all articles
Browse latest Browse all 15932

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>