Getting the correct page number

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!!!!!!!!!!!

Hi schiuma24,
I just modified your JS code, Please try the below code its works fine!
var myDoc = app.activeDocument;
var myRoot = myDoc.xmlElements[0];
var myPageNode= myRoot.evaluateXPathExpression("//page");
for (var x = 0; x < myPageNode.length; x++){
    var pageNumber  =  myPageNode[x].xmlAttributes.itemByName("id").value.replace(/[a-z]/gi, "");
    var myTypeOfPage = myPageNode[x].xmlAttributes.itemByName("type").value;
    if (myTypeOfPage == "cyan"){
        myDoc.pages.item(pageNumber).appliedMaster = myDoc.masterSpreads.item("B-Cyan");
    else if (myTypeOfPage == "magenta"){
        myDoc.pages.item(pageNumber).appliedMaster = myDoc.masterSpreads.item("B-Magenta");
    else if (myTypeOfPage == "yellow"){
        myDoc.pages.item(pageNumber).appliedMaster = myDoc.masterSpreads.item("B-Yellow");
here is your mistake!!
   if (myTypeOfPage = "cyan"){// Here your not compare the the cyan, you assign the value.
thx,
csm_phil.

Similar Messages

  • How to get the total page number when using Crystal Report in JSP

    In my JSP, I use the class CrystalReportViewer to generate and display the report views. But this class only sypply the function to get the info of the active view.
    Thus with this info, I only can get the active view's page number. How can I get the report total page number without showing the last page first?
    Thanks.

    Anything you do without submitting to form has to be done on the client side (ususally by JavaScript) using data which has been send already from the server.
    With JavaScript you can do quite a bit. You can download tables which don't necessarilly appear on the screen, loading them into JavaScript arrays by dynamically generating javascript. Then you can pick up events like drop-box selection and use these tables to chose what you do next (e.g. preloading other fields, setting drop box content etc.).
    Or, you can cause forms to be submitted when actions like a selection happen without the user clicking a button. It's generally a matter of how much data you'd need to transmit.
    Another posibility is to use a Java applet, which can generate requests to the server and handle the results as it chooses. That are a number of problems with that but occasionally it's the best solution.
    What you can't do is to handle user input inside a JSP. The JSP has come and gone before the user even gets to see your form.

  • Quick question: How to get the scrolled page number using af:table

    Hi,
    When using range paging on scrolled table, how to get the current scrolled page number(1,2,3...), for example when moving the table vertical scroll bar forward or backward, is there any method in ViewObjectImpl class that I can use to get such information? I have seen the method scrollToRangePage(int i), but when scrolled ("Fetching data..."), it doesn't not get into this method. So it is wrong usage for this method, right?
    Thanks

    Didn't you just ask that question in this thread?: How to catch the page number when using scroll table in ADF 11g?
    A bit of patience might be in order.
    CM.

  • How to get the last page  SAP Script form

    How to get the last page  SAP Script form.
    I want to print a specific information in the last page of SAP form (Script). Please tell me how to get the last page number.
    Regards

    Hi
    You have to check the system variable &NEXTPAGE&, if it's 0 it means you're in the last page.
    From SAP Help:
    This symbol is used to print the number of the following page. The output format is the same as with &PAGE& .
    Note that on the last page of the output, in each window that is not of type MAIN, &NEXTPAGE& has the value 0.
    /: IF &NEXTPAGE& = '0'
       Last page
    /: ENDIF
    Max

  • Pdf reader that will let me print the current page number to stdout ?

    I'm looking into annotating my readings, and it'd really speed things up if I were able to get the current page number printed to stdout.
    I've been through evince and xpdf's manuals, the latter will let you output the file to ps, so there might be some hacking possible there, but maybe there is a more convenient alternative...?
    Would appreciate some suggestions.
    Cheers !

    Sure that works, it's just that I'm already wrapping my pdf reader in a ruby script to allows me to make annotations linking back to the original document and page, and I also use the clipboard to quote.
    So instead of being a keybinding away, I end up have to juggle with windows...

  • I purchased photoshop elements 8 on line in 2010. I recently switched to a new desktop computer. Photoshop asked for my serial number. I entered the correct serial number (obtained from Adobe). It says it is invalid. How do I get this corrected so I can u

    I purchased photoshop elements 8 on line in 2010. I recently switched to a new desktop computer. Photoshop asked for my serial number. I entered the correct serial number (obtained from Adobe). It says it is invalid. How do I get this corrected so I can use the product I purchased?

    Hi Rosera,
    This is bad and I am sorry to hear that you are running into these issues.
    Let me connect with you, so right now, the current state is that you have installed copy of PSE 8 in trial on your windows 7 machine, and when you are trying to enter the serial number from your PSE 8 Box, it is saying the serial number to be invalid?
    It might sound pretty obvious, but please make sure that you are entering the serial number correctly and of PSE 8(in case you bought a PEPE box)?
    Have you tried the steps mentioned below by Barbara?
    If possible, you can send me the serial number through PRIVATE MESSAGE and I can check it on my end that whether the serial number is indeed invalid or that the issue is with your machine?
    Regards,
    Ankush

  • I lost my redemption code to install Lion onto my new computer. Is there a way I could get it again? When I go to the "get the update" page, it says that my serial number already has a code. How do I find this code again?!

    I lost my redemption code to install Lion onto my new computer. Is there a way I could get it again? When I go to the "get the update" page, it says that my serial number already has a code. How do I find this code again?!

    It is probably broken. You can try restoring it using Recovery Mode, but if that fails its time for a new phone. After all, it is 4 generations out of date. See: Recovery Mode

  • HT201260 I have OSX 10.5.8. I want to download Pages & Numbers for that version. ow do I get the correct version?

    I have OSX 10.5.8. I want to download Pages & Numbers for that version. How do I get the correct version?

    Buy an iWork 09 DVD from a source such as Amazon or eBay.
    (90971)

  • I am having trouble printing I have a connection to my printer wirelessly but does not print out the correct page I want.When I do print I get a bunch of pages more than is needed and also get a code and symbols please help I am jammed at work

    I am having trouble printing I have a connection to my printer wirelessly but does not print out the correct page I want.When I do print I get a bunch of pages more than is needed and also get a code and symbols please help I am jammed at work

    This can be the result of selecting the wrong driver. An older, unsupported laser printer will sometimes work with the generic Postscript driver.

  • How to get the iphone serial number  in application?

    hello,  everyone
       i  really want to konw how to get the iphone serial number in aplication ?  As it's different from uniqueIdentifier ....
    thank you

    Michele is correct - sneep will help you get the serial from the running domain on the M3000 ,
    and it is a good idea to install STB on your machines.
    If that isn't possible for you, then sneep can be downloaded directly from [http://www.sun.com/sneep]
    I believe that on this platform, sneep gets the serial from the output of prtconf.
    There is a minor correction to be made :
    After installed SNEEP use "man sneep" for all technical details.The sneep man page is not linked into the shared man pages, so you need to use
    man -M /opt/SUNWsneep/man sneep
    with out going to OK prompt (Banner)It is worth noting that the serial shown in the OBP banner is not the product serial
    that you will find on the physical serial tag.
    The banner "serial" is the decimal equivalent of the host ID, which you normally get in hexadecimal from the "hostid" command.

  • I wanted to know why they call me when I do not show the number but I get the words private number, and even when I call out to another private number.

    I wanted to know why they call me when I do not show the number but I get the words private number, and even when I call out to another private number.I tried it in the settings to activate id shows but nothing has changed. I hope you can help me.

    Cloud programs do not use serial numbers... you log in to your paid Cloud account to download & install & activate... you MAY need to log out of the Cloud and restart your computer and log back in to the Cloud for things to work
    Some general information for a Cloud subscription
    Log out of your Cloud account... Restart your computer... Log in to your paid Cloud account
    -Sign in help http://helpx.adobe.com/x-productkb/policy-pricing/account-password-sign-faq.html
    -http://helpx.adobe.com/creative-cloud/kb/sign-in-out-creative-cloud-desktop-app.html
    -http://helpx.adobe.com/x-productkb/policy-pricing/activation-network-issues.html
    -http://helpx.adobe.com/creative-suite/kb/trial--1-launch.html
    Does your Cloud subscription properly show on your account page?
    If you have more than one email, are you sure you are using the correct Adobe ID?
    https://www.adobe.com/account.html for subscriptions on your Adobe page

  • How can i get the correct text from the url which has the mulitp-languages?

    hi, all
    i built a application and deployed it on sun application server 8.1. when i request a url which include some multi-languages (for example http://xxx.com/servlet?value=XXX. the 'XXX' may be simply chinese. ), i got the ??? instead of the correct text. how can i do it? in tomcat server, i can set the URIEncoding=GBK to get the correct code in server.xml. how can i do it in sun app server?
    thanks.

    Ok, it is unclear on what is happening here.
    Are you saying that when the webclient gets the data that it is not honoring the quote characters? Or the processing of the data buffer is causing issues?
    This is what I see the of your example text which is trying to be parse out:
    <a onmouseover="EnterContent('ToolTip','תווית על בגד: &rsquo;&rsquo;תן לאישה לכבס. זה תפקידה&rsquo;&rsquo;','<u><span style=color:#000099;>כתב: Spook בתאריך: 08.03.15 שעה: 22:11</span></u><br>מחאת טוויטר קמה בעקבות תוויות שוביניסטיות שהדפיסה חברת אופנה באינדונזיה לפיהן תפקיד הכביסה מוטל על האישה. החברה התנצלה אך כנראה רק עשתה רק יותר נזק לע...'); Activate();">";
    It appears to me that the  escapes `&rsquo;` does not have matching `&ldquo;` anywhere within the tooltip. So it appears that the page properly places left quotes in when processing the page, but the raw html has broken text.
    Hence a garbage in, garbage out situation.
    William Wegerson (www.OmegaCoder.Com)

  • I Sorted but I am trying to get the correct Month to print

    {noformat}I am creating a program that requires me to get the highest number and lowest number in a month.I have sorted the Array into a 1 dimesional Array of [12]. Here is my issue How do I get the Highest and lowes number reported while How can I get the correct Month to print? I keep getting Jan and Dec obviously since they are the first and last month.
    I am not sure how to do a sort that will get me the proper month.
    I am creating a program that requires me to chose the highest number and lowest number of the 12 months calculated. I created a seperate sorting array. Currently these number are in the indexed memory location. This Array of numbers is not Initialized! I am just showing what is currently in memory.
    double total [12]={114,93.10,89.30,92.90,98.40,111.00,102.40,105.40,81.40,82.60,80.90,113.40} .
    //intialized
    String[] months={"January","February", "May","June","July","August","September","October","November",
    "December"};
    Here is my issue How do I get the Highest and lowest number printed that also corresponds with the correct month? I have a String of months. I just dont understand how I can do this. My highest numner is 114 which is January and my Lowest 80.89 is November. Is there another part of the swapping I am missing?
    Here is my code. Thank you for your help. I am having issues getting proper code formatting.
    import java.util.Scanner;
    import java.io.*;
    import java.util.*;
    import java.util.Arrays;
    public class MonthRain
        public static void main(String[] args) throws IOException
                    String[] months={"January","February", "March","April","May","June","July","August","September","October","November",
                    "December"};
                    final double [] [] rain = {
                    { 10.1,8.1, 6.8, 4.2, 2.1, 1.8, 0.2, 0.3, 1.1, 2.3, 6.1, 10.4,6.6,5.5, 3.8, 2.8, 1.8, 0.2, 0.0, 0.0, 0.0, 1.3, 2.6, 4.2,2.3, 6.1, 7.4,6.6, 5.5, 3.8},
                    { 9.2, 9.8, 4.4, 3.3, 2.2, 0.8, 0.4, 0.0, 0.6, 1.7, 4.3, 5.2,6.6,5.5, 3.8, 2.8, 1.8, 0.2, 0.0, 0.0, 0.0, 1.3, 2.6, 4.2,2.3, 6.1, 7.4,6.6 },
                    { 6.6, 5.5, 3.8, 2.8, 1.8, 0.2, 0.0, 0.0, 0.0, 1.3, 2.6, 4.2,6.6,5.5, 3.8, 2.8, 1.8, 0.2, 0.0, 0.0, 0.0, 1.3, 2.6, 4.2,2.3, 6.1, 7.4,6.6, 5.5, 3.8},
                    { 4.3, 4.3, 4.3, 3.0, 2.0, 1.2, 0.2, 0.2, 0.4, 2.4, 3.5, 6.6,6.6,5.5, 3.8, 2.8, 1.8, 0.2, 0.0, 0.0, 0.0, 1.3, 2.6, 4.2,2.3, 6.1, 7.4,6.6, 5.5, 3.8},
                    { 8.5, 8.2, 1.2, 1.6, 2.4, 0.0, 5.2, 0.9, 0.3, 0.9, 1.4, 7.3,6.6,5.5, 3.8, 2.8, 1.8, 0.2, 0.0, 0.0, 0.0, 1.3, 2.6, 4.2,2.3, 6.1, 7.4,6.6, 5.5, 3.8},
                    { 10.1,8.1, 6.8, 4.2, 2.1, 1.8, 0.2, 0.3, 1.1, 2.3, 6.1, 7.4,6.6,5.5, 3.8, 2.8, 1.8, 0.2, 0.0, 0.0, 0.0, 1.3, 2.6, 4.2,2.3, 6.1, 7.4,6.6, 5.5, 3.8},
                    { 9.2, 9.8, 4.4, 3.3, 2.2, 0.8, 0.4, 0.0, 0.6, 1.7, 4.3, 5.2,6.6,5.5, 3.8, 2.8, 1.8, 0.2, 0.0, 0.0, 0.0, 1.3, 2.6, 4.2,2.3, 6.1, 7.4,6.6, 5.5, 3.8},
                    { 9.2, 9.8, 7.4, 3.3, 2.2, 0.8, 0.4, 0.0, 0.6, 1.7, 4.3, 5.2,6.6,5.5, 3.8, 2.8, 1.8, 0.2, 0.0, 0.0, 0.0, 1.3, 2.6, 4.2,2.3, 6.1, 7.4,6.6, 5.5, 3.8},
                    { 6.6, 2.5, 3.8, 2.8, 1.8, 0.2, 0.0, 0.0, 0.1, 1.3, 2.6, 4.2,3.6,5.5, 3.8, 2.8, 1.8, 0.2, 0.0, 0.0, 0.0, 1.3, 2.6, 4.2,2.3, 4.1, 7.4,6.6, 5.5, 3.8},
                    { 2.6, 5.5, 3.8, 2.8, 1.8, 0.2, 0.0, 0.0, 0.3, 1.3, 2.6, 3.2,6.6,5.5, 1.8, 2.8, 1.8, 0.2, 0.0, 0.0, 0.0, 1.3, 2.6, 4.2,2.3, 6.1, 7.4,6.6, 5.5, 3.8},
                    { 4.3, 1.3, 4.3, 3.0, 2.0, 1.2, 0.2, 0.2, 0.4, 2.4, 2.5, 3.6,6.6,2.5, 1.8, 2.8, 1.8, 0.2, 0.0, 0.0, 0.0, 1.3, 2.6, 4.2,2.3, 6.1, 7.4,6.6, 5.5, 3.8},
                    { 8.5, 8.2, 1.2, 1.6, 2.4, 7.0, 5.2, 8.9, 0.3, 0.9, 1.4, 7.3,6.6,5.5, 3.8, 2.8, 1.8, 0.2, 0.0, 0.0, 0.0, 1.3, 2.6, 4.2,2.3, 6.1, 7.4,6.6, 5.5, 3.8}};
                   double [] total=new double [12];
                   double total_rain=0;
                   double average=0;
                   int col=0;
                   int row=0;
                   int i;
                                  for( row=0;row<rain.length;row++){
                                       total_rain=0;
                                       for( col=0;col<rain[row].length;col++){
                                          total_rain+=rain[row][col];
                                               average=total_rain/(col+1);
                                               total[row]=total_rain;
                                       System.out.printf("%9s Total Rain= %4.2f\n ",months[row],total[row]);
                                       System.out.printf("%9s Montly Average= %4.2f\n ",months[row],average);
                                       System.out.printf("\n");
                                               for(i=0;i<total.length;i++){
                                                 System.out.printf("Total Rain=%.2f\n",total);
                                                 double minValue;
                                                                          int sort,index,minIndex;
                                                                          for(sort=0;sort<total.length-1;sort++)
                                                                               minIndex=sort;
                                                                               minValue=total[sort];
                                                                               for(index=sort+1;index<total.length;index++)
                                                                                    if(total[index]<minValue)
                                                                                         minValue=total[index];
                                                                                         minIndex=index;
                                                                          total[minIndex]=total[sort];
                                                                          total[sort]=minValue;
                                                                     System.out.printf("High Rain=%s and Low Month=%s\n",total[sort],total[0]);
                                                                     System.out.printf("\n");
    Edited by: happyfootsie on Dec 6, 2009 1:12 AM
    tried to fix formatting                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    happyfootsie wrote:
    Here is my issue How do I get the Highest and lowes number reported while How can I get the correct Month to print?OK, apart from the fact that you've dumped everything in one place as opposed to breaking up your logic, the main thing I can see is that you have no inherent mapping between the values that you're storing and the months that they apply to.
    That's all fine while you're just pulling in the values (I assume that each block of 12 is listed from January to December), but the second you do a sort, you lose the fact that '114.93', which is probably now in last place (being the highest) actually referred to the month of January.
    First suggestion: break it up into methods (a couple of suggestions would be 'getAverages() and 'sort()', but I'm sure there's more).
    Second suggestion: Have a look at the Java Collections framework (you might want to start here). It has a shed-load of classes for doing exactly what you want.
    Winston

  • How do I go about getting the product serial number to register my product as well as install my product.  I bought it with a product box.  On the software disc sleeve, there is a series of numbers pasted at the bottom of the sleeves but this is not valid

    How do I go about getting the product serial number to register my product as well as install my product.  I bought it with a product box.  On the software disc sleeve, there is a series of numbers pasted at the bottom of the sleeves but this is not valid.  When I tried to type this in for registration, it does register as this numbers also contain letters in it.  Apparently the registration boxes accept numbers only.  What do I do with a useless product for which I have paid good money for it?????

    This is the simple solution which was offered to me when I tried to get the serial code on line.
    The box and disc sleeve do not contain a series with 24 numbers which I presume is the product code to install.
    I tried to redeem the registration code by following what they recommended, but inevitably it gets to the page that showed the registration boxes that need 24 serial numbers and I got stuck again.
    This product is so different what my previous experiences of other software products where I just enter the serial number straight from the disc sleeve and then I got registered and go on to use the software.
    I is really frustrating, spending the last two hours trying to get my product going....

  • How can I get the correct Ship To (KNVP-KUNNR2) for a Sales Document?

    I am trying to generate a report that will (among other things) display the Ship To ID and Name for a given Sales Document.  I know the following information:
    VBAK-VBELN - Sales Document
    VBAK-VKORG - Sales Org
    VBAK-VTWEG - Distribution Channel
    VBAK-SPART - Division
    VBAK-KUNNR - Sold To Party
    I know that the table KNVP will return a list of Ship-To Customer numbers (KUNNR2) for a Sold-To Customer (VBAK-KUNNR) if I also filter by VKORG, VTWEG, and SPART (using SE16N).  What I don't know is which one of the returned values is being used in a particular Sales Document.  The customer in question has 29 Ship-To locations.  How do I find out which Partner Counter (KNVP-PARZA) the Sales Document uses? I don't know where that value would come from.  Once I can get the correct Ship-To Customer Number, I should be able to search the table KNA1 by WHERE KUNNR = KNVP-KUNNR2 and return KNA1-NAME1 for the Name of the Ship-To location.

    For a sales document?  Use VBPA with PARVW = 'WE'.  Also, use the ADRDA field to determine whether the address on the document has been manually changed.  In any case, you can use one of the many address management functions or just ADRC directly to get the name, address, etc., using the ADRNR field from VBPA or if the address is from the customer master, KNA1.

Maybe you are looking for