Moving objects incrementally based on page number

Hey all,
Trying to automate a group of objects moving down a page, driven by the page location in a book.
New to scripting, just need some pointers on best practise, gotchas etc.
Any thoughts?

Using a script doesn't make it 'live', the object will not be 'affected' after you move it once. But apart from that, it's pretty simple.
Given a current page number n, a number of pages ntot, a page height h, and an object height oh, you can use this calculation for the top position:
topy = n*(h – oh)/ntot
You can change an object's y position by writing the value into its geometricBounds array:
var myBounds = someFrame.geometricBounds;
myBounds[2] = myBounds[2] - myBounds[0] + topy;
myBounds[0] = topy;
someFrame.geometricBounds = myBounds;
As you can see, you have to read and write the array in one single piece. You need to change two elements: number [0] holds the top y position, number [2] holds the bottom y position. As you can see, you have to 'calculate' the bottom first, based on the top (A good alternative is using the move function but I can't write that from the top of my head.)

Similar Messages

  • How to increment a value in a textfield based on page number

    Hi,
    I am doing PDF based print forms which is non interactive, i got a requirment where i have to increment the binded value of a text field based on page number.
    presently i am using this code in initialize event of that textfield.
    var curpage = $layout.page ( ref ( $ ) )
    var totpages = $layout.pageCount()
    $.rawValue = $.rawValue - totpages
    $.rawValue = $.rawValue + curpage
    but this is not helping me, can anyone help me regarding this

    Thanks for yor reply.please you can tellme clearly how to set use 'NQ_SESSION.USER' to set the value to logged in User.i.e i have circle table in that users and circle names will be there.it is teradata database.so how can i set that in to the dashboard prompt and one thing along with that prompt the follwing prompts will be there
    mobile no<>
    date<>
    circle name<"user">
    this is my requirement so please help me step by step what to do for achiving this.
    thanking oyu

  • Adding logic based on page number

    Hi,
    in my invoice report, i need to add some logic based on page number. My objective is to print a group of 4 lines (OMR Marks) on right hand side of the page. For example, on first page, print 1st line only, on second page, print 2nd line only, on third page, print 1st and 2nd lines only, on 15th page, print all four lines, on 16th page, print lines similar to 1st page i.e. print 1st line only, on 17th pages, print lines similar to 2nd page i.e. print 2nd line only.
    Is there any way to use page number or some other variable that can represent page number in an IF condition? Your help is highly appreciated.
    Regards,
    sanjai misra

    Thanks for your reply.
    I need to print OMR marks in our invoice report and i am not sure how to do it. I will highly appreciate your inputs.
    I have to print OMR mark a per the logic given below
    1. Divide the page number by 15
    2. Based on remainder value, print 4 horizontal lines. For example,
    if remainder is 1 then print only line 1,
    if remainder is 2 then print only line 2.
    if remainder is 3 then print line 1 and line 2.
    If remainder is 4 then print only line 3,
    if remainder is 5 then print line 1 and line 3
    if remainder is 6 then print line 2 and line 3
    if remainder is 7 then print line 1, 2, 3
    if remainder is 8 then print only line 4 and so on
    if remainder is 0 then print all lines i.e. line 1,2,3 and 4.
    Could you please tell me how I could achieve this? If you have some code that you could share, it would be great.
    OR is there some other way to achieve this?
    Thanks,
    sanjai misra

  • Modify width of rectangle based on page number in InDesign via Javascript

    I have a rectangle called `pageBar` on my master page !
    I would like to create a script that will automatically resize the width of the rectangle based on the page number.
    Something like : `width = 1280 * (pageNumber / pageTotal)`
    Any help would be much appreciated.
    Thanks in advance,
    J.

    Here's the script I ended up with. I'm a bit unhappy that I ended up having the literal string "pageBar" in it twice. The second instance is there to allow the script to be run on the same document twice -- that's one of the prices you pay for using master page items in a script rather than creating objects on the fly and applying an object style to them (better than setting selected properties):
    //DESCRIPTION: Size PageBar on each page
    (function() {
              if (app.documents.length > 0) {
                        sizePageBars(app.documents[0]);
              return;
    function sizePageBars(aDoc) {
              var pageBar = getMasterItem(aDoc, "pageBar");
              if (pageBar == null) return;
              // walk through the document's pages and deal with each page
              var theMaster = pageBar.parent;
              var numPages = aDoc.pages.length;
              for (var j = numPages - 1; j >= 0; j--) {
                        if (theMaster == aDoc.pages[j].appliedMaster) { // ignore pages with other masters
                                  processPage(aDoc.pages[j]);
              function processPage(page) {
                        // numPages, pageBar and j are visible as global variables in this function
                        // caculate desired width
                        var desiredHalfWidth = 1280 * (j + 1)/(numPages * 2); // j starts at zero;
                        // could be running script for a second time, so check to see if page already has pageBar on it
                        var bar = page.rectangles.item("pageBar");
                        if (bar == null) {
                                  var bar = pageBar.override(page);
                        var pBounds = bar.geometricBounds;
                        var xCenter = (pBounds[3] + pBounds[1])/2;
                        pBounds[1] = xCenter - desiredHalfWidth;
                        pBounds[3] = xCenter + desiredHalfWidth;
                        bar.geometricBounds = pBounds;
              function getMasterItem(aDoc, name) {
                        var appliedMaster = aDoc.pages[0].appliedMaster;
                        var anItem = appliedMaster.rectangles.item(name);
                        if (anItem == null) {
                                  alert("Couldn't locate 'pageBar' rectangle.");
                        return anItem;
    I was going to introduce to the resize method, but that would have first meant understanding it myself. The description in the object model viewer is a masterful demonstration of how not to communicate complicated information.
    So I did a web search and found myself on this page by Marc Autret: http://www.indiscripts.com/post/2013/05/indesign-scripting-forum-roundup-4
    Search that page for resize and you'll see what I mean. Compared to the simple manipulation of geometric bounds, using resize is a nightmare of complexity. Marc has simplified it by providing a function you can call, but I decided to just go with using the bounds.
    I hope this proves helpful to you.
    Dave

  • Conditional formatting based on page number that resets on repeating frame

    Hello everyone,
    I have searched through multiple forums on multiple sites and haven't come across anyone who has accomplished this.
    I have a report with pages numbers that reset on a repeating frame.
    I have a text boiler plate that I want to only show up on page 1. On every occurrence of page 1.
    SRW.GET_PAGE_NUM does not work because it returns physical page number.
    I'm trying to access the value of the field for my page number. The value comes from "source" drop down with value of "Page Number".
    I've tried accessing the <&page number> in the PL/SQL of my conditional formatting trigger but no luck.
    This report is 14K plus pages so I'd rather not be inserting and selecting the value back out of the database.
    Does anyone have any ideas??
    Thanks,
    Alan

    To avoid inserting/selecting from the database
    Maybe you could create a small package on the database to store page numbering information.
    Then use get/set routines per your requirements.
    CREATE OR REPLACE PACKAGE rep_page_no IS
       gPageNo NUMBER;
       PROCEDURE set_it(pPage NUMBER);
       FUNCTION get_it RETURN NUMBER;
    END rep_page_no;
    CREATE OR REPLACE PACKAGE BODY rep_page_no IS
       PROCEDURE set_it(pPage NUMBER) IS
       BEGIN
          gPageNo := pPage;
       END set_it;
       FUNCTION get_it RETURN NUMBER
       IS
       BEGIN
          RETURN(gPageNo);
       END get_it;
    END rep_page_no;Then in your repeating frame you could access this package rather than insert/select from any database table.
    Let me know if this works, I might like to try it.
    Thanks

  • Need help printing pagefooter conditionally based on page number

    In the layout I'm working on, there is a <?call:footer?> in footer section. I want to avoid call it for certain pages. Eg. not print it on the first page.
    Is there a page-variable available that can be used to conditionally test and print this? (in example below find something replacing "currentpagevariable")
    Eg. <?if:currentpagevariable!='1'?><?call:footer?><?end if?>
    Note, I've tried to use the "Different first page" option, but due to reports complexity in report header, cannot use this option.
    Any suggestions as soon as possible would be much appreciated.
    /Thanks, Dan

    this is not possible.

  • Dynamic text based on page number

    Hi Everyone,
    I'm trying to place a dynamic text on an hrform. The form is displaying wage types and when there are more than 2 pages, the values on the first page need to be summerized into a variable with the text subtotal in front of it. When we are on the last page, the text total with the total of all the wagetypes needs to be displayed. I tried to use the sfsy-page and sfsy-formpages variables to know on which page i am but the strange thing is that when i use in in program lines and i use debugger to look into the variable i get this:
    First page:
    sfsy-page = 1
    sfsy-formpages = 1
    Second page:
    sfsy-page = 2
    sfsy-formpages = 2
    But when i place it into a text element to test i get 1 of 2 on page one and 2 of 2 on page two. How is this possible?
    Also i want to display a subtotal of the displayed wagetypes per page. Anyone an idea how i can do that?
    Thank you!
    Lars

    Hi,
    The reason you get 1-1 ,2-2 in debugging is because, the pages are added dynamically,depending on the length of your main window.Which doesnt get captured initially,but can be used in text element.
    As far as totalling on every page and at the last page is concerned ,try teh following link:
    link: [http://wiki.sdn.sap.com/wiki/display/ABAP/Togetsubtotalsoneachpagein+smartforms]

  • How to use page-number in xsl:if

    Hi
    I would like to use <fo:page-number/> in my if clause. Based on page number, I would like to add some more fields.
    If help on this greatly appriciated.
    Thanks,
    Ram.

    i'd like to check page num, if page num > 1 then output current page of total pages. if it's possible, plz tell me how?
    because i used check row num to do this, its not right method.

  • How to create a HMI page to control moving object

    Hello
    Good day
    I want create a Pc based HMI page to control the moving object (robot). I dont have knowledge in HMI. Plz help me with some ideas.
    My application conditions: 
    In HMI page -  to show input distance(X), start values (W- weights) which gives output(Q(X)) in two condition
     Q< 0 - move forward
    Q< 0  - stop (or move backward)
     And also feedback is given to input which give new start vaues (weights) and output runs contuinously.
    Equation in matrix form : X^T = (distance  1 ) , W^T = (W1 W0)
                                       output Q(X^T) = X.W^T = Distance. W1 + W0 
    Plz plz help me.
    Thanks in advance.

    Hi chittu,
    Developping code with LabVIEW always takes place in two separate windows, the block diagram and the frontpanel.
    In the block diagram you will do all programming operations like implementing your equation in program code.
    In the frontpanel you have the possibility to pre-give and adjust the input parameters for your equation, e.g. X, W.
    You can also display any values from the block diagram, e.g. Q(X), in a graph. So that is your HMI.
    Being able to send commands to your robot and communicate with it, you will need a hardware driver.
    In LabVIEW, you can use VISA to implement nearly every Hardware-driver available.
    The conclusion is, that LabVIEW is the perfect tool for your intent. But even if programming with LabVIEW is intuitive and effective, it is not trivial.
    So I strongly recommend you to learn LabVIEW in a professional way. In my opinion the best way to do that is to visit LabVIEW courses,
    where professional teachers will give you the needed knowledge and the skills to realize your project.
    The following links give you an overview of the courses, the possibilities to learn LabVIEW and some getting started hints.
    How to Learn NI LabVIEW
    http://www.ni.com/academic/labview_training/
    Introduction to NI LabVIEW
    http://www.ni.com/gettingstarted/labviewbasics/
    Getting started with LabVIEW
    http://www.ni.com/pdf/manuals/373427c.pdf
    Best Regards,
    JoLe
    National Instruments
    Applications Engineering
    www.ni.com/support

  • Not able to reset the page number in XML Publisher based on each PO

    Not able to reset the page number in XML Publisher based on PO
    Hi,
    I have created a custom purchase report and rtf template. In the rtf template, I have added the page number feature (i.e. Page 1 of 5) from Word in the template. When I run the report for a range of POs, I expect the results as follows:
    I have given 3 POs on single request. (PO#1 has 3 pages, PO#2 has 2 pages and PO#3 has 4 pages), the page number on each PO should look like as follows:
    PO#1 page 1 of 3, page 2 of 3, page 3 of 3
    PO#2 page 1 of 2 page 2 of 2
    PO#3 page 1 of 4, page 2 of 4, page 3 of 4 and page 4 of 4
    But the page number displays on each PO as follows:
    PO#1 page 1 of 9, page 2 of 9, page 3 of 9
    PO#2 page 4 of 9 page 5 of 9
    PO#3 page 6 of 9, page 7 of 9, page 8 of 9 and page 9 of 9
    Here I have to reset the page number based on each PO. If anyone done this already, can you please share with me.
    Thanks,
    Ram.

    Hi
    One clarification please.
    Are you putting Page # of ## in the for-loop section? I mean it should be within For-each@section block.
    Even if this doesn;t work, then try using Insert->Page Break after every PO.
    Regards
    Varun

  • Hiding Image field based on the page number in Adobe Form- Script

    Hi Folks,
    I have a problem with the print form that I am working on. I need to insert an image of lines (OMR) based on the page numbers. For the OMR part, the first page will always have 4 lines as a image, the middle pages will have 3 lines as a image and the last page will have two lines as a image.
    I have uploaded these 3 images a BMPs in SE78 and I am using Xstring of these images in the form. I have two master pages. First master page is for the first page and the second master page is for the remaining pages. The first master page will always have the 4 line image. I created a positioned subform in the master page2, in that subform, I have 2 hidden numeric fields, as the run time properties one for the current page number, other one for the total number of pages. I placed those two images(one for the three line image and the other one for the two line image) exactly on the same location positioned dimensions wise. 
    I have written the java script for these two image fields to show based on the page numbering. But, somehow, it is not working. Can anybody please let me know where I am doing wrong. I am posting my java script here.
    for the three line image:
    var cp = data.PageSet.MasterPage2.OMR.cpage.rawValue;
    var np = data.PageSet.MasterPage2.OMR.npages.rawValue;
    //if(data.#pageSet[0].MasterPage2.OMR.cpage.rawvalue == data.#pageSet[0].MasterPage2.OMR.npages.rawvalue){
    for (j=0; j<xfa.layout.pageCount(); j++){
      if(cp == np){
        xfa.resolveNode("data.PageSet.MasterPage2[" + j + "]").OMR.OMR2.presence = "hidden";
      else{
        xfa.resolveNode("data.pageSet.MasterPage2[" + j + "]").OMR.OMR2.presence = "visible";
    For the two line image:
    var cp = data.PageSet.MasterPage2.OMR.cpage.rawValue;
    var np = data.PageSet.MasterPage2.OMR.npages.rawValue;
    for (j=0; j<xfa.layout.pageCount(); j++){
      if(cp == np){
        xfa.resolveNode("data.PageSet.MasterPage2[" + j + "]").OMR.OMR3.presence = "hidden";
      else{
        xfa.resolveNode("data.pageSet.MasterPage2[" + j + "]").OMR.OMR3.presence = "visible";
    Please give me a direction as this is kind of hurry.
    Thanks,
    Srinivas.
    Edited by: srinivas kari on Jun 9, 2010 2:03 AM

    HI Otto,
    Thanks for the response. You are right, I am struck with this image. My problem was to keep the OMR marking on each page based on the page number. It is like a lines with 10mmX10mm dimension at the top right corner for the sorter machine to know the number of pages to put in the envelope. The logic for this is, on the first page, it has 4 lines each 3mm apart. On the middle pages it has 3 lines . On the last page it has 2 lines. When the sorter machine picks these, it looks at the first page with 4 lines, it will count as a first page, it will continue through the 3 line pages as the middle pages until it reaches the 2 line to know it as the last page. This is all happens in the master pages. I have two master pages , one for the first page and the second one for the remaining pages.
    At first I did not know how to To achieve this, I created 3 images. one with 4 lines, another ones with 3 lines and 2 lines. The 4 lines image was on the first master page. The 3 lines and 2 lines images were on the second master page at the same place as the image fields positioned. Thats where I was trying this scripting. I was trying to capture the current page and number of pages. Based on these, I was trying to place them.
    Is there any other way to achieve this instead of using the images? I thought of sy-uline. but some in the forum told that its not going to work. Even if I use the sy-uline, I have to do some script to achieve this I believe.
    Any inputs on this.. Please give the direction.
    Thanks,
    Srinivas.

  • Hiding Image filed based on the page number in Adobe Forms - scripting

    Hi Folks,
    I have a problem with the print form that I am working on. I need to insert an image of lines (OMR) based on the page numbers. For the OMR part, the first page will always have 4 lines as a image, the middle pages will have 3 lines as a image and the last page will have two lines as a image.
    I have uploaded these 3 images a BMPs in SE78 and I am using Xstring of these images in the form. I have two master pages. The first master page will always have the 4 line image. I created a positioned subform in the master page2, in that subform, I have 2 hidden numeric fields, as the run time properties one for the current page number, other one for the total number of pages. I placed those two images(one for the three line image and the other one for the two line image) exactly on the same location positioned dimensions wise.
    I have written the java script for these two image fields to show based on the page numbering. But, somehow, it is not working. Can anybody please let me know where I am doing wrong. I am posting my java script here.
    for the three line image:
    var cp = data.PageSet.MasterPage2.OMR.cpage.rawValue;
    var np = data.PageSet.MasterPage2.OMR.npages.rawValue;
    //if(data.#pageSet[0].MasterPage2.OMR.cpage.rawvalue == data.#pageSet[0].MasterPage2.OMR.npages.rawvalue){
    for (j=0; j<xfa.layout.pageCount(); j++){
    if(cp == np){
    xfa.resolveNode("data.PageSet.MasterPage2 [" + j + "]").OMR.OMR2.presence = "hidden";
    else{
    xfa.resolveNode("data.pageSet.MasterPage2 [" + j + "]").OMR.OMR2.presence = "visible";
    For the two line image:
    var cp = data.PageSet.MasterPage2.OMR.cpage.rawValue;
    var np = data.PageSet.MasterPage2.OMR.npages.rawValue;
    for (j=0; j<xfa.layout.pageCount(); j++){
    if(cp == np){
    xfa.resolveNode("data.PageSet.MasterPage2 [" + j + "]").OMR.OMR3.presence = "hidden"; // there is some problem while //posting it is like MasterPage2[" + j + "]")
    else{
    xfa.resolveNode("data.pageSet.MasterPage2 [" + j + "]").OMR.OMR3.presence = "visible";
    Please give me a direction as this is kind of hurry.
    Thanks,
    Srinivas.
    Edited by: srinivas kari on Jun 9, 2010 12:04 AM

    HI Otto,
    Thanks for the response. You are right, I am struck with this image. My problem was to keep the OMR marking on each page based on the page number. It is like a lines with 10mmX10mm dimension at the top right corner for the sorter machine to know the number of pages to put in the envelope. The logic for this is, on the first page, it has 4 lines each 3mm apart. On the middle pages it has 3 lines . On the last page it has 2 lines. When the sorter machine picks these, it looks at the first page with 4 lines, it will count as a first page, it will continue through the 3 line pages as the middle pages until it reaches the 2 line to know it as the last page. This is all happens in the master pages. I have two master pages , one for the first page and the second one for the remaining pages.
    At first I did not know how to To achieve this, I created 3 images. one with 4 lines, another ones with 3 lines and 2 lines. The 4 lines image was on the first master page. The 3 lines and 2 lines images were on the second master page at the same place as the image fields positioned. Thats where I was trying this scripting. I was trying to capture the current page and number of pages. Based on these, I was trying to place them.
    Is there any other way to achieve this instead of using the images? I thought of sy-uline. but some in the forum told that its not going to work. Even if I use the sy-uline, I have to do some script to achieve this I believe.
    Any inputs on this.. Please give the direction.
    Thanks,
    Srinivas.

  • How do I pull up the left control panel that allows you to move from text to moving objects on page?

    How do I pull up the left control panel that allows you to move from text to moving objects on page?

    Do you mean this one:
    If so, go to the Window menu and make sure that Tools is checked.

  • Can't see 'white' colored page number on colored object/paper

    I am using Pages '09 (v 4.3) and am having a devil of a time trying to get a 'white colored' page number to show up over a colored object that is streched over the sheet/paper to provide a color background. The problem seems limited to only when I want to use white, as any other color in the palette will show (assuming that there is enough contrast between the background color and selected page number color). I'm seeing this problem in a sheet where I want to use a black background with white text in the body (no issue there) and a white colored page number. Anyone else seen this? Or perhaps I have missed something simple?

    Peter -
    Is it there when you zoom in? No amount of zoom or lack thereof changes the situaiton.
    Is it there if you increase its point size? Nope.
    Is it there if you change the font? Nope.
    Have you tried using white from the Color Picker? Yes, no matter how white is selected the end result is the same.
    What is the Opacity of the text in the Graphic Inspector? Text does not have an opacity option/selection. Perhaps you are asking what the Opacity is of the solid color I am trying to set as the background, in which case it is 100%.

  • IDML: page number of anchored object

    In an idml file exported from ID an anchored object lives in a Story container and a Story has a relationship with a TextFrame.
    Because a TextFrame can appear in any number of Spreads, it seems to be impossible to tell the page number where an anchored object appears without opening the idml file in the ID GUI and looking at the Link palette.
    Is there any solution to this behaviour?
    In other words, is there any way to programmatically tell the page number of an anchored object introspecting an idml file?
    Thanks in avdance.
    __peppo

    An update.
    I resolved the issue by introspecting an indd file (not an idml export) from JavaScript and now I am a little bit curious on why this difference between the two object models.
    Can someone explaint to me the rationale of having in idml an anchored object as a child of a Story instead of a Page?
    regards,
    __peppo

Maybe you are looking for

  • System Properties user.timzone different between dev. and prod. system

    Hi all, I am facing the following issue: In our development system I get in http://<server:port>/sap/monitoring/SystemProperties -> dispatcher -> system properties a Europe/Berlin for user.timezone. In our productive system I get in http://<server:po

  • Commit events are not broadcast because no JMS Transport is available.

    Just set up a new WebLogic 10.3.2 domain and I am seeing this while starting the Admin Server: <Mar 1, 2010 6:37:03 PM CST> <Error> <Security> <BEA-000000> <Commit events are not broadcast because no JMS Transport is available. Remote L2 caches will

  • Can't drag and move objects

    Using the Selection tool, i can select any object, but i can't click hold and drag it to a different position, like i usually can. I can click on one sides, or corners, and scale it just fine. I can also select it, right click, transform, move, enter

  • The display queue window is blank - message mapping

    Hi, sometimes, when I want to see the queues in IB: Design in the mappings, the queue window is just blank. any ideas?

  • Smartform for purchase order.

    Hello friends,     I am creating the smartform for purchase order printing whih is attached to output type ZNEU and that output type is used in ME23N.     But at the time of creating versions in PO in ME22N it is giving error messages of diffrant typ