Get the index of the current page?

Hello, I can't understand, how to get the index of the current Page in a document. I can't use "activePage.name" as the name cannot show the actual number of the current page. In the forums, I found the following function for javascripts indexOf() function.

If (!.) Array.prototype.indexOf) {}

Array.prototype.indexOf = function (searchElement / *, fromIndex * /) {}

"use strict";

If (this == null) {}

throw new TypeError();

}

var t = Object (this);

var len = Extremity > > > 0;

If (len = 0) {}

Returns - 1;

}

var n = 0;

If (arguments.length > 0) {}

n = Number (arguments [1]);

If (n! = n) {/ / shortcut to check if it is NaN}

n = 0;

} Else if (n! = 0 & & n! = Infinity & & n! = - infinite) {}

n = (n > 0 |-1) * Math.floor (Math.abs (n));

}

}

If (n > = len) {}

Returns - 1;

}

var k = n > = 0? n: Math.max (len - Math.abs (n), 0);

for (; k < len; k ++) {}

If (k t & & t [k] = searchElement) {}

return k;

}

}

Returns - 1;

}

}

With that, I then wrote the following code:

myDocument var = app.activeDocument;

myPages var = myDocument.pages;

var number = myPages.indexOf(myDocument.layoutWindows[0].activePage);

Unfortunately, it does not work. When I warn "myPages" I can see, I get the pages object. I know somehow get just the array with the values of the present?

Thank you in advance! Appreciate any help!

app.activeWindow [0].activePage.documentOffset

Of course, documentOffset, no index. Thank you for noticing.

Tags: InDesign

Similar Questions

  • Adaptive tags: pt: data .currpagedata - could not get the current page id

    I use a Basic Page layout and need to create a DIV box which is linked to the Page ID - < div id = "pt-page-1234" >. The Page ID must be inserted dynamically when you navigate around the pages.

    I try to use the Adaptive tags pt: data to get the ID of the current Page; Therefore, I am currpagedata. When I use the attribute of the object ID of the object, I get the Community ID (which seems to be a bug).

    Does anyone know how I can get the current Page ID on a pt tag: data? Here is my current code:

    < pt:ptdata.currpagedata pt:id = "currPage" / >
    < pt:logic.foreach pt: data = "currPage' pt:var = 'temp' >
    < pt:logic.variable = pt pt:key: value = "$temp.objid" / "currPageId" >
    < /pt:logic.foreach >
    < pt:logic.concat pt:key = 'target' pt:value1 = 'pt - page -"pt:value2 ="$currPageId"/ >
    < pt:core.html pt:tag = "div" id = "$target" >

    I get... < div id = "pt-page-245" > but the page ID is 4015

    Published by: user11124236 on July 2, 2010 10:44

    Hello

    This may be too late, but for other people who have the same problem, use. PageID instead of .objid (case-sensitive).






    See you soon,.

    Jefi Santoso
    Collaboration technologies (http://www.collaborativetechnologies.com.au)

    Edited by: jefis on 14-Sep-2010 17:20

  • Get the current PAge

    I want a QML solution to find out which page is open. I had nested in the tabs Pane Navigation components, most of this navigation is carried out automatically. How know when a page is in sight? I want something like 'onCreationCompleted', but which is only called when the Page is created.

    Basically, I need reminders such as onResume(). or onPause(); that you get in Android.

    for a navigationpane, you can use https://developer.blackberry.com/cascades/reference/bb__cascades__navigationpane.html#function-topch... or the top property.
    The TabbedPane gives you the activeTab or activePane.

  • Get the current name of the page without the aid of a bean

    Hello, everyone!

    If I would get the current name of the page to a page, I'd do something like this:
    #{bean.currentPageName}
    @SessionScoped
    @Named
    public class Bean
    {
        public String getCurrentPageName()
        {
            return FacesContext.getCurrentInstance().getViewRoot().getViewId();
        }
    }
    But my question is: is it possible to get the name of the current page directly from the xhtml page without using a bean? Is it something related to it or information available to the page itself? If so, how can I access it?

    Thank you in advance.

    Marcos

    Use the same semantics in the page:

    #{facesContext.viewRoot.viewId}
    
  • How can I get the name of the current page and the number?

    Hello world!

    Anyone know how to get the name of the current page and the number? What variable I should he request?

    Thanks in advance!

    The question of the application defined by the system: APP_PAGE_ID is the page number. For the name of the page, you will need to query the view of Apex with something like this:

    Select PAGE_NAME
    of APEX_APPLICATION_PAGES
    where PAGE_ID =: APP_PAGE_ID

    Good luck

    Stew

    PS Feel free to mark this reply as being correct, so it is.

  • I can not open a new tab anyway... by clicking on the button new tab bar tabs, or ctrl/T or file/new tab, or by clicking on the link on the current page.

    On Windows7 Home Premium Edition, I can't get a new tab to open no matter what I try. Occasionally, if I click on a link on the current page, a second tab opens, but 99% of the time I'm stuck using the first tab for everything and using the back button. I tried ctrl/T, tab file/new, right mouse click / New tab and the new button tab in the tab to the right of the current tab bar.

    Uninstall the Ask Toolbar. It can cause this problem.

    If this answer solved your problem, please click 'Solved It' next to this response when connected to the forum.

    Not related to your question, but...

    You may need to update some plug-ins. Check your plug-ins and update if necessary:

  • Get the current value of the menu a cluster ring

    Hello

    I am trying to program a bunch of rings of menu to use the same options and disable the option even in the other rings of menu if it has already been chosen. It works essentially as is at the moment, but it shows each button by using a 'deactivated' option because I'm turning off the option even in the buttons that have this value. I did it using a loop knot and property and [] DisabledItems en mass. Now, I want to go to the iteration of the loop for the menu ring which already has this value.

    To do this however, I want to get the current numeric value of the ring of menu and an array of search values. If the value of menu rings appear in this table, then I want to move to the current iteration of the loop. The problem I have is that when I try to use a property node and type the property value, instead of giving me a long 32 output, it gives me the so-called 'Variant', which I have not seen before. I'm not sure how to find a table and see if the value I have is in this table. "Search table" seems just an index to be returned, I think that I want a Boolean or something. I'm also not sure how to skip an iteration of the loop (although I imagine it won't be too difficult to understand mine, I hope).

    I apologize if this is very obvious, or if my message is not clear. I started using LabVIEW, a few weeks ago and I'm still learning. I have included a picture of my Subvi downstairs.

    Thank you
    Nathan

    Variant of data allows to convert the variant to a numeric type (whatever representation you need).

    Search D 1 table returns-1 if the element was not found.  If you just compare the index with a greater or equal to zero and the result will be if the element was found in the table.

  • How can I get the current state "onto the Pixels?

    Hello community,

    Here's the function that creates a switch that handles "snap to Pixels":

    index.html:

    <div id="STP_input" onclick="switchOnOff(this)">
         ...
    </div>
    

    main.js:

    $("#STP_input").click(function () {
         var a = switchOnOff(this);
         if (a) {
              csInterface.evalScript('switchSTP(true)');
         } else {
              csInterface.evalScript('switchSTP(false)');
         }
    });
    

    HostScript.jsx:

    function switchSTP(checkBTN) {
        'use strict';
        
        var condition;
        if (checkBTN === true) {
            condition = true;
        } else {
            condition = false;
        }
    
        var idsetd = charIDToTypeID( "setd" );
        var desc26 = new ActionDescriptor();
        var idnull = charIDToTypeID( "null" );
            var ref6 = new ActionReference();
            var idPrpr = charIDToTypeID( "Prpr" );
            var idtoolsPreferences = stringIDToTypeID( "toolsPreferences" );
            ref6.putProperty( idPrpr, idtoolsPreferences );
            var idcapp = charIDToTypeID( "capp" );
            var idOrdn = charIDToTypeID( "Ordn" );
            var idTrgt = charIDToTypeID( "Trgt" );
            ref6.putEnumerated( idcapp, idOrdn, idTrgt );
        desc26.putReference( idnull, ref6 );
        var idT = charIDToTypeID( "T   " );
            var desc27 = new ActionDescriptor();
            var idtransformsSnapToPixels = stringIDToTypeID( "transformsSnapToPixels" );
            desc27.putBoolean( idtransformsSnapToPixels, condition );
        var idtoolsPreferences = stringIDToTypeID( "toolsPreferences" );
        desc26.putObject( idT, idtoolsPreferences, desc27 );
        executeAction( idsetd, desc26, DialogModes.NO );
    
        return;
    }
    

    But when I hide the Panel and show once again, that the switch back to the default state, turn on my Panel, not "hook to Pixels" PS settings setting. Is it possible to get the current status 'Hang the pixels' setting? How?

    Best regards.

    See post 8 in this thread:

    Re: Need someone to update or create script: "snap to grid of pixels.

  • Enkitec Toolbar... Stop the menu items of the current page of derivative

    XE Summit 4.2 11.2

    Hi all.  Question today: I am using the Enkitec toolbar in my application. and everything works fine... except...

    Ive changed the application so the I have a series of reports that point to the same page to run a number of interactive reports with different settings...   They are grouped into a number of items in the submenu.

    However, the Enkitec menu is highlighting the current page. Like all items in menu 4 are all active page (or URL active), he sets them all to the same color blue., so instead of a list of menu with all the white background, I get a menu list when they are all blue...

    So Im trying to either disable the 'select the menu for the active page item' (easier) or somehow allow him to recognize that its actually a variant of the same page... (the settings are different...)

    Ive tried overiding the CSS with what I think is correct according to the how to on the web site Enkitec, but without success...

    If anyone could offer advice, Id be grateful...

    Kind regards

    Richard

    Hi Richard,

    Are you sure that's not because of the condition of the sub components?

    I'm sure you check 'in progress' through the list.

    Thank you

    -Jorge

  • Grep search only on the current page, return array "search everything".

    Hello

    Is there a way to grep search only the current page, or any page chosen in my paper (myDocument.pages [i])?

    I can only manage to search for in the document.

    app.findGrepPreferences = app.changeGrepPreferences = null;

    app.findGrepPreferences.findWhat = "Chapter (\d+)";

    myDocument.findGrep)

    Also, is there a way to return the content to find? In this case, I want the $1 this research...

    var a = myDocument.findGrep (). ?

    Thank you

    Christopher

    the error is because you have not initialized the tabular myRet variable.

    Another problem is the use of textframes.everyItem (), because that returns a different object.

    and another is what happens if a textframe is empty you will get an error on the meaning of "object has no text for find/replace.

    Here is the fixed code:

    var myRet=[]
    var myDocument=app.activeDocument;
    var tf = myDocument.pages[0].textFrames.everyItem().getElements(),
    tf1 = myDocument.pages[0].textFrames.count();
    app.findGrepPreferences = app.changeGrepPreferences = null;
    app.findGrepPreferences.findWhat = "Chapter";
    for (var i = 0; i < tf1; i++){
     if (tf[i].characters.length){
    myRet=myRet.concat(tf[i].findGrep());
    }
    }
    alert(myRet)
    
  • Using the current Page number in IF Condition

    Hello

    I have a requirement to insert a blank page if the last page in the group number is odd, then I'll try to use the syntax below, but its does not work:

    <? If: page-mod number 2! = 0 ? >

    < xsl: attribute name = "break-after" > page < / xsl: attribute >

    <? end if? >

    The number of pages in my report is 5 and if I put 5 instead of the page number in the code above, the blank page is inserted, but it seems that this page number is not acknowledged in the IF condition, and if I put <? fo:page - number? > instead of page number in the if condition, I get an error.

    How can I write an if condition based on the current page number?

    Thank you

    Patrick

    Try using the below command

    Have a condition before you group items

    -jump - number of pages F

    EmpNo

    Ename

    F EMPNO

    ENAME E

    E

    same-jump-number of pages---> contains


    When you want to manage the deletion of the pages of the total number of pages

    You can use the following command in the form same-jump-number of pages field-->

    Thank you

    If this allows you then, please check the answer "correct" or even "useful."

  • How to get the current value of the checkbox button programmatically in the adf

    Hello
    I want to get the current value of the checkbox (checked/unchecked or 0/1) in my bean java whenever I press the button "submit" on my page jspx.

    My version of JDeveloper is: 11.1.1.6.0

    Where the value checkbox link? The State of the check box is held in the value property of the check box. This is normally an EL as

    #{bindings.Myvar1.inputvalue}
    

    or something pointing to a bean property. This value can be read from the listener to the action of the submit button

            BindingContainer bindingContainer = BindingContext.getCurrent().getCurrentBindingsEntry();
            AttributeBinding attr = (AttributeBinding)bindingContainer.getControlBinding("Myvar1");
            Object obj = attr.getInputValue();
    

    Timo

  • [CS5.5] how to import a code snippet in the current page

    Hi all

    I got IDOMElement of the document UIDRef and imported to the code snippet. Here's the code-

     InterfacePtr<IDOMElement> documentElement(docRef, UseDefaultIID());
    
     if (documentElement == NULL)
        break; 
    
     if ((status = Utils<ISnippetImport>()->ImportFromStream(tStream, documentElement)) == kSuccess) 
        //success
    

    ( tStream is the IPMStream of the code snippet that I'm importing)

    This code above is able to import the extract with success on the first page of the active document, but I can't be imported into current page instead. So to do this, I tried to get IDOMElement of UIDRef of the current page instead (logically, I thought this will import the excerpt of the current page).

     InterfacePtr<IDOMElement> documentElement(currentPageUIDRef, UseDefaultIID());

    But the result is still - the documentElement is not null, but the code snippet is imported to the first page only.

    Maybe the concept of IDOMElement is not clear to me, but I find that no documentation in the SDK Guide too. Can someone explain to me what is an IDOMElement and how to import a snippet of the current page?

    Any help will be much appreciated. Thank you.

    Hello Shawn,

    have you tried the IDOMElement of the propagation or layer? You can't place items on a page.

    Markus

  • Item ID (4113731174273456) is not an element defined in the current page.

    Hi all

    All of a sudden, I get an error on a page after upgrading to 4.1:
    Item ID (4113731174273456) is not an element defined in the current page.

    This happens on submit (apex.submit ()), so I don't see what he is trying to address. Debugging is useless.

    I looked through the process and the elements on the page, but without seeing anything that would cause.

    Does anyone have any ideas on how I can reduce the problem?

    Thank you!
    John

    APEX 4.1.0.00.32 on 11g.

    Can you view the page source and find in the text, "4113731174273456", which can be close to the questionable item?

    or

    Ask the apex_application_page_items of the item view:

    select * from apex_application_page_items where item_id = 4113731174273456
    
  • How to make the current page menu item displayed in a different font color?

    Hello

    My menu bar works very well. The links I get the text to hover display the desired color. Now I want the item menu of the selected page show a third color.

    With live-code activated in Dreamweaver CS6, I can see the following code is generated by the dynamic menu:

    "< script type =" text/javascript"src="/CatalystScripts/Java_DynMenusSelectedCSS.js "> < / script > <!-dynamic output CSS menu start-> < div id ="cat_549633_divs"> < ul id ="nav_549633">< class li ="selected"> < a href =" / home.html "> home < /a > < /li >< li > < a href =" "/ leistungen.html" > Services < /a > < /li > < li > < a href = "/ uhrenservice.html" > Uhrenservice < /a > < /li " "> < li > < a href =" / versteigerungen.html "> Versteigerungen < /a > < /li > < li > < a href =" / diamanten.html "> Diamanten < /a > < /li > < li > < a href =" / ueber_uns.html "" > Uber each < /a > < /li > < li > < a href = "/ kontakt.html" > Kontakt < /a > < /li > < /ul > < / div > < script type = "text/javascript" > catSetSelectedCSSItem ('nav_549633'); < /script > <! - end of output CSS Dynamic Menu - >

    The .selected class is created in the first element of the list (home) because it is the current page.

    And here is my CSS:

    {#nav_549633}

    float: right;

    list-style-type: none;

    padding-top: 5px;

    }

    #nav_549633 li {}

    float: left;

    text-align: left;

    }

    #nav_549633 li a {}

    color: white;

    text-decoration: none;

    margin: 27px 0 0 0;

    font size: 13px;

    text-transform: uppercase;

    }

    #nav_549633 Li a: hover {}

    color: yellow;

    }

    {.selected

    color: Green;

    }

    The green font color does not appear. It is still white.

    In order to see if the class 'works"I tried a few other attributes that work!

    {.selected

    color: Green;

    padding: 20px

    background-color: blue;

    }

    In this case, the item appears as a blue box with 20px padding, just as expected - but the font color is always white.

    Can someone help me?

    Kind regards

    Herman

    Hello Ginoem50,

    Looking at your css looks like the selected class does not work because the li #nav_549633 one is more specific is the one who is listened to.

    change .selected li.selected a #nav_549633 and it should work.

    Hope this helps,

    Chad Smith | http://bcgurus.com/Business-Catalyst-Templates for only $7

Maybe you are looking for

  • Reminders app - update.quota_exceeded

    Hello I'm having a problem with apple app reminders 1st in mac app reminders - I tried to move 50 reminders in 1 list-seems to work ok but does not appear on the iPhone - when I try to move a reminder in 1 list to the other - it syncs on other device

  • Tecra A2 - need XP drivers for LAN and WLan card

    Hey,. I have a little old... computer laptop Toshiba Tecra A2 of second hand and apparently his need for an ethernet controller and network controller player.I used the website of toshiba to download many drivers for this laptop model successfully. I

  • Satellite A50 - cannot log into windows

    Hey guys, i struggled to connect to windows. When I turn on my laptop, the toshiba start screen appears and then after that it says: "Please select the operating system to start."There are 2 options to restore Windows xp home edition and windows xp h

  • PSC 2175 Print gray boxes behind the text

    Recently this HP PSC 2175 printer has been printing gray background behind all the text boxes.  It comes from occurring when printing from Windows, launching a test print to options for control panel of the printer, or clear text copy.  See the examp

  • Script engine "VBScrip' for the 'C:\Windows\System32\OEM\_NowIntoDT.vbs' script is not found.

    Hi guys, I have a new desktop computer (a month) under window 7 Home Premium, 64-bit operating system.  A few hours ago, when I turned on the computer, it boots up to the usual bright but the strange message below appears and continues to appear on t