How to you reference the current page number and total pages in a script?

I'm trying write a small script to make field invisible when the current page equals the total number of pages, but with no luck.
Can anyone advise how to do this?
I've tried various ways to reference my fields, this being the most basic:
if(pageNumber == totalPages) {
continuedBase.presence = "invisible";
// pageNumber has a run time property as "Current Page Number"
// totalPages has a run time property as "Number of Pages"
// continuedBase is a text field within the same subform as pageNumber and totalPages
Thanks for any help offered.
Russell

If you are asking how to get the current page and total pages you acn use these commands:
current page ----- xfa.layout.page(this)
total pages ------ xfa.layout.pageCount()
so your code woudl look like this:
app.alert("The curent page is: " + xfa.layout.page(this));
app.aler("The total number of pages is: " + xfa.layout.pageCount());
if(xfa.layout.page(this) == xfa.layout.pageCount()) {
continuedBase.presence = "invisible";

Similar Messages

  • How do you reference the current version of DIAdem through an automation reference?

    I need a way to find out which version of DIAdem is active. REading the registry doesn't help, because DIadem simply registers subkeys and doesn't keep track of multiple versions. Can I do this via the DIAdem API? Thanks.

    Hi DecaGregg,
    Yes, you can query which version of DIAdem you have on the other end of an OLE Automation Server connection. Use the ToCommand server's "IntegerVarGet" method and one of 3 internal DIAdem variable names to get the information you want. Try double-clicking on the VBScript attached below from Windows Explorer to see what it looks like from a text-based program.
    If you are controlling DIAdem from LabVIEW, there is a built-in VI in the LabVIEW-DIAdem Connectivity VIs that does this version querying for you.
    Have fun,
    Brad Turpin
    DIAdem Product Support Engineer
    National Instruments
    Attachments:
    DIAdemVersion.VBS ‏1 KB

  • SapScript, How do I read the current line number?

    I have sections of text - each in it's own element with an 'include' of the standard text.
    These sections are variable in size.
    All elements are in the MAIN window.
    I do not want a paragraph to split over two pages.
    How do I read the current line number within the sapscript before the section prints so I can issue a new-page command at the beginning of the paragraph?
    Thanks!

    Yes, that does work for paragraphs.
    If I have multiple elements to print from within a loop where "at first, at each and at last" each call the Sapscript funtcion write_form - how can I keep the whole section together.  protect/endprotect will keep each element together but not the group of elements.
    There must be a way to find the current line number.

  • How to find dynamically the current line number in the source file

    Is there a mechanism like __LINE__ and __FILE__ macro in C to get dynamically
    the current line number and file name of a source file?

    Don't know - but others have asked too. Have you searched the forum? For example:
    http://forum.java.sun.com/thread.jsp?forum=31&thread=210496

  • How do you get  the count of number of  checkbox selected?

    hi,
    plz tell me how do you get the count of number of checkbox selected?

    Not sure what you are doing so I will attempt to answer your question. If have one question which can have multiple answers you have will recieve an array so you have to do getParameterValues("name") and move it into an array.
    If you have multiple questions and only value will be selected do a getParameter("name") on each form element.
    HTH, if not provide more detail.
    J.Clancey

  • HT201303 For added security how do you change the iphone security number to stop hacking

    For added security how do you change the iphone security number to stop hacking

    Forgotten security questions - https://discussions.apple.com/message/18402551
    More involved forgotten question issues - https://discussions.apple.com/thread/3961813

  • How do you change the iMessages phone number?

    how do you change the iMessages phone number on the iPad mini? 

    Using FaceTime http://support.apple.com/kb/ht4319
    Troubleshooting FaceTime http://support.apple.com/kb/TS3367
    The Complete Guide to FaceTime + iMessage: Setup, Use, and Troubleshooting
    http://tinyurl.com/a7odey8
    Troubleshooting FaceTime and iMessage activation
    http://support.apple.com/kb/TS4268
    iOS: About Messages
    http://support.apple.com/kb/HT3529
    Set up iMessage
    http://www.apple.com/ca/ios/messages/
    Troubleshooting Messages
    http://support.apple.com/kb/TS2755
    Setting Up Multiple iOS Devices for iMessage and Facetime
    http://macmost.com/setting-up-multiple-ios-devices-for-messages-and-facetime.htm l
    FaceTime and iMessage not accepting Apple ID password
    http://www.ilounge.com/index.php/articles/comments/facetime-and-imessage-not-acc epting-apple-id-password/
     Cheers, Tom

  • HT203175 How do you change the backround color on your Itunes page.

    How do you change the backround color on your Itunes page.

    JLabel textLabel = new JLabel ("Radius: ",JLabel.RIGHT);
    textLabel.setForeground (Color.black);
    i hope this helps
    good luck

  • How do you find the iPad phone number for cellular data?

    How do you find the iPad phone number for cellular data?

    I know this post was a long time ago but people still seem to be viewing it.
    Quickest way:
    Via the iPad on 3G, go to http://m.telstra.com. The service number is then displayed and you are given the option to recharge.

  • How can I replace the current contacts list and put in my own

    How can I replace the current contacts list and put in my own?  My son's name and contact list appear, inadvertently loaded when he used the iPad.  I have an iPad mini, fully updated to iOS 7.0.4.

    He must have signed into his icloud account using your device.  You need to disconnect the device from that account and then sign in using your account ID.
    Go to Settings>icloud, scroll to bottom of screen and tap Delete Account.  Then log in using a different ID.

  • How can you keep the caps lock on and not unlock after each letter?

    How can you keep the caps lock on and not unlock after each letter?

    I'm not aware of an online keyboard that is available and can do this. Most likely it would need to be a function of the app itself (which can and sometimes do add functionlaity to the keyboard).
    Wireless keyboard might handle that, if that's an option for you.
    I work in IT myself, and IMHO the iPad isn't the ideal device for coding or scripting work.

  • How do you record the current index?

    Hi everyone,
    Im sorry if this problem seems basic, but I have a for loop that controls motor movement, and I have a separate while loop that is responsible for all data acquisition. I am wondering if there is a way to record the current index number from the for loop in my DAQ loop? I tried wiring the index down to the array in the while loop, but it seems to prevent the while loop from starting up.
    I can throw up some pictures if necessary, but im hoping this can be done easily.
    Thanks!

    Please do not "throw up pictures".  Instead, post code.  Attach a VI, or create a Snippet (which looks like a picture, but can be dragged onto a LabVIEW Block Diagram and, by NI Magic, becomes executable, editable, clickable LabVIEW code.
    Bob Schor

  • HT1459 Serial number is faded and too small to read. Itunes will not recognize my IPod Classic. How can I delete the current iPod software and reinstall it to see if this would solve the problem?

    I recently upgraded my Itunes softeware, now itunes will not recognize my IPod Classic. If I delete the current IPod software and reinstall it, would this solve the problem, and if so, I'll need step by step instruction.

    Yep.
    Take a look here:
    http://www.snsforums.com/index.php?showtopic=235
    It appears that SANmp is indeed the most likely source of your problem.

  • HT201274 How do you cancel the "erase all content and settings" process?

    I started the "erase all content and settings" process and its seems to be taking forever, please how do i cancel the "erase all content and settings" process?

    Welcome to Apple Communities
    Try to turn off your device holding the Sleep button. Then, turn on, connect it to your computer and restore with iTunes

  • JavaScript:  How do you pass the currently active doc to a dialog in a menu item?

    I'm using Adobe Acrobat 11.0 Standard on Windows 7, and I'm having trouble with the menu item that I'm creating.  The menu item calls a dialog that prompts the user to select a page in the currently active document.  The problem is, I can't figure out how to pass the currently active document to the dialog.  I scoured the rest of the documentation, did searches on Google and here in the Adobe forums, but haven't turned anything up.  The AcroJS API gives the following solution (found under app/methods/execDialog):
    This function attaches the Doc object to the dialog box, then passes the dialog box to the app.execDialog method. The dialog4 object and this function can be at the document level.
       function dotheDialog(dialog,doc)
            dialog.doc = doc;
            var retn = app.execDialog( dialog )
    Finally, the following script can be executed from a mouse-up action, for example.
        dotheDialog( dialog4, this );
    I did this exact thing, but in the dialog, the value of this.numPages still comes out as undefined, indicating that the current document still hasn't been passed.  My own code looks like this:
      function dotheDialog(dialog, thisDoc){
        dialog.doc = thisDoc;
        var retn = app.execDialog(dialog);
      app.addMenuItem({
        cName: "Test Dialogue Box",
        cParent: "Edit",
        cExec: "dotheDialog(templateDialogue, this);"
    where templateDialogue is the name of my own dialog, rather than dialog4.  I'm not sure what the retn variable that they declare in the documentation is for, but I've tried it with and without that part, and it doesn't seem to make a difference.  Does anyone know how to do this?

    Sorry, here it is.  It's also just a small modification of something directly from the API, which is why it still has the date bit in it.
    var templateDialogue = {
      initialize: function (dialog) {
        // Create a static text containing the current date.
        var todayDate = dialog.store()["date"];
        todayDate = "Date: " + util.printd("mmmm dd, yyyy", new Date());
        dialog.load({ "date": todayDate });
      commit:function (dialog) {    // called when OK pressed
        var results = dialog.store();
        var inBounds = (parseInt(results["tPag"]) < this.numPages);
        if(!inBounds){
          app.alert({
            cMsg: "Please enter a valid number for the page from which to make the template." +
            "\n" + parseInt(results['tPag']) + " = parseInt(results['tPag']) !< this.numPages = " +  // I put this in to see the value of this.numPages,
            this.numPages,                                                                           // and it continues to be undefined.
            cTitle: "Page out of Bounds",
            nIcon: 0, nType: 0
        }else{
          var nButton = app.alert({
            cMsg: "Your template is named " + results["tNam"] + " and is made from page " + results["tPag"],
            cTitle: "javascript",
            nIcon: 3, cType: 0
      description:    {
        name: "Personal Data",    // Dialog box title
        align_children: "align_left",
        width: 350,
        height: 200,
        elements:
            type: "cluster",
            name: "Add a page to this documents templates.",
            align_children: "align_left",
            elements:
                type: "view",
                align_children: "align_row",
                elements:
                    type: "static_text",
                    name: "Template Name: "
                    item_id: "tNam",
                    type: "edit_text",
                    alignment: "align_fill",
                    width: 300,
                    height: 20
                type: "view",
                align_children: "align_row",
                elements:
                    type: "static_text",
                    name: "Generating Page: "
                    item_id: "tPag",
                    type: "edit_text",
                    alignment: "align_fill",
                    width: 300,
                    height: 20
                type: "static_text",
                name: "Date: ",
                char_width: 25,
                item_id: "date"
            alignment: "align_right",
            type: "ok_cancel",
            ok_name: "Ok",
            cancel_name: "Cancel"
    Side Question:  Out of curiosity, how would you abort if the user clicks cancel?  I get the feeling that they don't cover it because it's something you're supposed to already know how to do, but...I don't.  Would you just put whatever action you want to take into an if ( button == "Ok" ) type statement so that cancel does nothing?

Maybe you are looking for

  • Since uploading OS 4.3.2, I can no longer sync Outlook Calendar to my 3GS iPhone. Any suggestions?

    Since uploading OS 4.3.2, I can no longer sync my Outlook Calendar to my 3GS iPhone. Any suggestions?

  • Hf901-00001 won't install at all on some instances.

    Hi, We have multiple servers with CF 9.0.1 installed, all with the multiple servers configuration and all with multiple instances. Yesterday I started patching to hf901-00001 (http://kb2.adobe.com/cps/890/cpsid_89094.html).  It worked properly on 30

  • Forms highlighted

    Hi, I have add some text forms to a pdf file in acrobat 9 pro extended. When the file is opened in Reader the new forms are highligted by default. I don´t want the forms to be highlighted. Is there anyway to save the pdf so the forms are not highligh

  • EXTREMELY slow to open files - Illustrator CC 2014!

    Hi, I just updated from Maverick to Yosemite 10.10.1 See my system config on this monosnap link: http://take.ms/2CAxh I have installed the latest Illustrator CC - 18.1.1 See monosnap link: http://take.ms/lgqj0 I have a big problem everytime I try to

  • Problem Configuring Shared Services

    Hi guys, i am configure the EPM system configurator 11.1.1.3 with SQL server it shows the error like "shared servie database not found in the specified database"