Get pages referenced in the Index of each pageReference
Hello!
I'm working on a script that tries to examine all references on each topic of an index page to remove duplicates and build page ranges...
So far, I get the referenceType for each pageReference, but it returns only the 'referenceType' and not the current page as the object model Indesign 8 wrote:
PageReferenceType.CURRENT_PAGE (read-only)
Data type: number, value: 1668444263
Adobe InDesign CS6 (8,0) Object Model
The page where the index entry.
The followin script write in console the name of each topic and its references (as if 1668444263 is of type CURRENT_PAGE), and I would get the real current page number...
Any help really appreciated!
var index = app.documents [0] .indexes [0];
for (i = 0; i < index.topics.length; i ++)
{
.write $("sujet:" + index.topics[i].name + "\n");
for (t = 0; t < index.topics [i].pageReferences.length; t ++)
{
pRef = index.topics [i] .pageReferences [t] .pageReferenceType var;
.write $(pRef + "\n");
}
}
The type tells you what type of index entry page number it is :)
Try .sourceText- http://jongware.mit.edu/idcs6js/pc_PageReference.html#sourceText - that points to the PointInsertion in the text, the location of the index entry itself. From that you can use its parentTextframe and next one parentPage to get the page number (which should be the 'name' of the page).
Tags: InDesign
Similar Questions
-
Change the Page numbers in the index
Hello
I have a catalog and I added two pages in the middle of the catalog. Now, due to the addition of two pages, I need to update the page numbers on the index with the new page numbers. I only need to increase each of the page by two numbers, but that starts only at a certain point. Thus, for example, on one of the index I have, 1-70 page numbers may remain the same, since the two extra pages were added AFTER page 70. But every number after 70 must increase by 2.
I have a find and replace script. I create a table in excel and drop into the document. The script then takes any word or number that is listed in column A and replace it with what is in column B. I used initially this script to find and replace in the catalog product codes, and it worked great, because all the product codes were quite unique.
Try to use this same script to change the page numbers, but she totally fizzled. The problem is that the same number is repeated later in the table, so the script has the table constantly replace all numbers with the first two. So, here is a small sample of my table:
Col Col B
423 425
422 424
421 423
420 422
But when I run the script, here is what it will turn into:
Col Col B
423 becomes 425 425
422 becomes 424 424
421 becomes 425 423 becomes 425
420 becomes 424 422 becomes 424
Because it alters the table, all corresponding numbers in the document then will increase to 425 or 424.
Is there a way to ensure that the script does not change the information in the table that she uses as a reference?
Here is the script below. I didn't write (makes a very nice person on these forums) and don't know anything about the scripts.
the_table = app.selection [0] .tables [0];
app.findChangeTextOptions = null;
with (app.findChangeTextOptions)
{
caseSensitive = true;
wholeWord = true;
}
app.findTextPreferences = null;
app.changeTextPreferences = null;
for (row = 0; row < the_table.rows.length; line ++)
{
If (the_table.rows [row] .cells [0] .silence == ")
continue;
app.findTextPreferences.findWhat = the_table.rows [row] .cells [0] .silence;
app.changeTextPreferences.changeTo = the_table.rows [row] .cells [1] .silence;
app.activeDocument.changeText ();
}Thank you very much!
It should work, but make sure you do backup first. I'm not going to say once: first make a backup copy. Yes, I said that you should make a backup first!
Copy the following script, paste it into an editor appropriate - Adobe ESTK which comes with InDesign is good enough. Save it as "omgwrongnumbers.jsx" in your user Scripts folder. Select as little text as possible, the script will be blindly increment (or decrement) all numbers in the range. And then double-click the script runs.
//DESCRIPTION:omg the page numbers are all wrong! // A Jongware Script 18-Aug-2010 if (app.documents.length == 0) { alert ("Oh give me some text to play with :'("); exit(0); } if (app.selection.length != 1) { alert ("We can't go on like this. Select some text first."); exit(0); } myDialog = app.dialogs.add ({name:"omg the numbers are wrong!",canCancel:true}); with (myDialog) { with (dialogColumns.add()) { with (dialogRows.add()) staticTexts.add ({staticLabel:"First to change"}); with (dialogRows.add()) aBox = integerEditboxes.add({editContents:"1"}); with (dialogRows.add()) staticTexts.add ({staticLabel:"Last to change"}); with (dialogRows.add()) bBox = integerEditboxes.add({editContents:"99999"}); with (dialogRows.add()) staticTexts.add ({staticLabel:"Add or subtract this value"}); with (dialogRows.add()) cBox = integerEditboxes.add({editContents:"2"}); } } if (!myDialog.show()) { myDialog.destroy(); exit(0); } first = aBox.editValue; last = bBox.editValue; step = cBox.editValue; if (first < 1 || first > last || step == 0) { alert ("Now you're pulling my nose arentya"); exit(0); } app.findGrepPreferences = null; app.findGrepPreferences.findWhat = "\\b\\d+\\b"; list = app.selection[0].findGrep(true); changes = 0; for (i=0; i
= first && n <= last) changes++, list[i].contents = String(n+step); } alert ("Number of changes: "+changes); -
the font size for the page numbers in the index
I use 10 FM, creating an index for a book. I can adjust the font size for the text down to 9 points, but page numbers are stuck at 12 points. I can do 9 point individually, but they return to 12 points, when I save the book. What should I do to get page numbers to stay in the point 9? The same thing happens if I use the character or paragraph Designer.
Earle Fox
In the ... IX.fm file, what are the attributes of the tag IndexIXpara font by default ?
No chance that they have been rejected by a character Format or a simple substitution of element prototype <$pagenum>$pagenum> on The IX reference Page?
-
Find the page source for the index entries
In ID CS4, I could Alt-Ctrl-click on the page number of an entry in my index and it would take me to the source page. This doesn't seem to work in CS5. Y at - it a keyboard shortcut that will do it, so I can check my index entries are correct?
Click the entry in the Panel Index, to open it. This will display a list of occurrences; Select one, then click on one of the itty bitty small icons at the bottom to go (I think it's on the left).
FM has allowed you to click directly in the generated index? Cool ID only adds hyperlinks in an exported PDF file.
-
The page referenced in the HTML element
I have a hidden field I want to display in the form of a title with a custom HTML formatting. Is this possible? I tried the following, but it shows he literally typed
< b >: P4_HOST_NAME < /b >Blake,
If you use a static region, you can use & P4_HOST_NAME. (Note the period at the end is required)
v ('P4_HOST_NAME') will work in a region of PL/SQL or PL/SQL program unit named, considering that: P4_HOST_NAME will work in a SQL query and the anonymous block within the APEX.
Thank you
-Scott-
http://spendolini.blogspot.com
http://www.sumneva.com -
How to get the item to the index by the listview in qml programming
Hi guys.
I'm sorry my English not good level.
At the point of selection Android listview to index easylly, I call ListView.selectionPosition (int index)
But when you use ListView on cascades qml, I think point get in way to the index.
Hope you help me.
For a simple DataModel with a single level of items, you can access the item at a specific position with code of God:
int position = 0
var MonElement = myDataModel.data ([position])-requires one [of QVariantList] -
Problem with hidden top nav on the index page
I use a free template that has a header that slids up to reveal nav simular to the footer.
This feature works fine on all my pages except for the index to premium - posts-.com
The problem is that I have no idea if the function... is javascript or CSS, I think it's CSS. I did "inspect" the elements on the page but did not find anything that looked as if it was the problem.
I would post code if I new what to post, I hope really that someone can point me in the right direction.
Any help would be greatly appreciated.
Seems to work OK in Firefox and IE8.
No need to post the code you provided a link to the site
-
How to determine the index of an item in a cluster?
I have a small program that I put in place, as I'm just trying to get up to speed on Labview. I have a boolean cluster buttons and for some reason the top button of the page is coming through as Index 3. There are four buttons in the cluster, but for some reason, there has been a change. The top must be Index 0. How to do the things fixed? I do not see how to determine the index of each button through properties.
Thank you
The order of items in a cluster is the same as the order that you added them. To change the order, just right click and select "rearrange controls in the group. If you use Unbundle by name, you don't care the order.
-
appearance of numbers without text to the index
Hello
I have an automatically generated index for fm 9, some numbers of page text (I see them below also correct) keep appearing as symbols
It's the first time I meet markers with start and end range
but I wonder if something is wrong and if I can do something about that...
Thank you
ElenaOpen marker window, then use the Hypertext (hold the button ctrl + alt and click on the page numbers) in the index to no access these NONE entires of text index. Inspect the content shown in the marker window and modify it (or remove) accordingly.
Each index Startrange entry must have a corresponding endrange. The spelling of the terms must be identical and FM is case-sensitive. See FM9 help for more details: http://help.adobe.com/en_US/FrameMaker/9.0/Using/WSd817046a44e105e21e63e3d11ab7f7561e-7fae .html #WSd817046a44e105e21e63e3d11ab7f7960b-7ec4
-
How the index data are managed within the cluster?
Hello
We are evaluating the consistency.
Regarding indexes, am I right in thinking that the data in the index are stored in a (managed internally) cache on the same node that the attendant at the following indexed values? I'm not interested in getting the data in the index, but rather just to understand how the data in the index itself are stored or processed within the cluster.
So in a 2 cluster node where an index is applied to a distributed cache that has only 2 entries, will there be a key cache on each node 1 {binary,} to enter key where the key points to the value that is stored on this same node? In other words, I'm sure that the index data to be spread out in the cluster in the case of a partitioned topology?
Concerning
Peteruser11279467 wrote:
HelloWe are evaluating the consistency.
Regarding indexes, am I right in thinking that the data in the index are stored in a (managed internally) cache on the same node that the attendant at the following indexed values? I'm not interested in getting the data in the index, but rather just to understand how the data in the index itself are stored or processed within the cluster.
So in a 2 cluster node where an index is applied to a distributed cache that has only 2 entries, will there be a key cache on each node 1 {binary,} to enter key where the key points to the value that is stored on this same node? In other words, I'm sure that the index data to be spread out in the cluster in the case of a partitioned topology?
Concerning
PeterHi Peter,.
up to 3.4.x index have been supported only on partitioned topology, and Yes, the index on each node contain only the data corresponding to the entries that have their main copy on this node (referred to as entered local subsequently).
The indexes are not stored in a cache, but they are managed under the information that maintains consistency in terms of backup (the map that contains local entries).
The indexes are in 2 parts:
-index to the front: this is a mapping of the cache key in an internal representation (Playback key card in the future) the value extracted with the extractor used to create the index of the entry to membership of the cache key (value extracted later)
-reverse index (aka. reversed card): this is a map of the value extracted from a backup set of the keys of the map of entries which we extract the index key reversed with the extractor used to create the index
The index can be sorted, which means that the index reversed a SortedMap (sort order is the order of the extracted values)
Let's see an example. Assuming you have the contents of the following cache within a particular extension storage node:
A--> Object (PositionX = 5,...)
B--> object (getA = 3,...)
C--> object (getA = 3,...)
D--> object (getA = 4,...)The index forward in this node will contain:
Binary (A)--> 5
Binary (B)--> 3
Binary (C)--> 3
Binary (D)--> 4The reverse index will contain:
3--> {Binary (B), Binary (C)}
4--> {Binary (D)}
5--> {Binary (A)}Where Binary (...) designates the internal representation (binary) of the... object.
If the index is not ordered, then the order of iteration over the entries in the index reversed are not deterministic.
If the index is ordered, the iteration of the entries into the inverted index will be as stated above. Also, you can convert the SortedMap inverted index in order to have the very useful headMap and tailMap and firstKey and lastKey methods.
I hope this helps.
Best regards
Robert
-
Various problems of generation of the index
Hello
I try to generate the index for my book, I was layoutet with InDesign.
Now, I am facing two problems.
Problem 1: Page numbers are wrong. The first two pages of the book, the cover and the backsite of it, has all the numbers and so the introduction to the book begins with "page 1". I solved this with the chapters. Now, if I'm looking for the title of page 43 of the index I see "Headline... page 45." This is because InDesign also has coverage and its backsite.
Problem 2: If I separated a cap with the key Enter it will appear twice as different entries in the index. If I separate a cap with shift + enter InDesign destroyed the index and also separates the title on two lines, but only as one input connected. But in addition it stretches the entries in the index above the full line because of justification.
All solutions
Concerning
maxpd
How to sequence the show on the pages Panel pages? Have you started a new article on page 1?
-
Branch to the Page identified by the element
Apex 3.2
The pages of my application is accessible in several ways, so I use branch to the page identified by the element.
Here I pass the page number of the calling page in a link to a hidden item (PX_PG) on the new page.
I created a branch to the page identified by the element on each page which refers to PX_PG. This is also related to the Cancel button.
It's that everything works fine.
My problem is clearing the cache of the page when you press the Cancel button.
There is no option to clear the cache in the branch and if I create a process page to clear the cache, then it is raised before
the branch, so my PX_PG value is cleared and my branch fails.
How can I add a cache clear to a branch to the page identified by the element?
GusGus,
If you want to delete news cache the current page, in this case page 12, then the following will work
f?p=&APP_ID.:&P12_PG.:&SESSION.::&DEBUG.:&APP_PAGE_ID.
If you want to explicitly reset page 12:
f?p=&APP_ID.:&P12_PG.:&SESSION.::&DEBUG.:12
I thought you wanted to clear the cache in the target page, my apologies.
Good luck
Tyson
-
How can I insert a continuation variable in the Index?
Hello
Many of the entries in the index of some of my level 1 manuals may have long lists of level 2 entries under them, and sometimes it will break the long list of columns or pages. I would like to start the new column or page with "Topic A," before returning to the list of entries of level 2 (where "Section A" is the level 1 entry). How can I do this? So far, I have two choices to deal with long lists of level 2 entries that break between pages/columns: (1) insert a page or column break before the level 1 entry, which can make this very short column with lots of empty space (doesn't look very good), or simply allow the entry of level 2 list to break without trying to keep the whole list in a single column. Sometimes, this works well, but there are times when no solution is sufficient and I would like to be able to inform the user that a list back to page 3 of the index is in fact the continuation of the same list on page 2.
Online help provides instructions for inserting variables continuation in the tables. I was unable to find information on how to add to a long list of Index entries.
I use FM version 8 for Windows (XP). However, I remember being able to do several years (between 1997 and 2002), so that this feature was present in early versions of FM unfortunately, I can't remember how to do it.
Thanks for any help!
Joyce
You must use a third-party utility, such as he is not a native capacity of FM. I suggest you Index Tools of Silicon Prairie (see: http://www.siliconprairiesoftware.com/Products.html).
-
schedule the index rebuild online
Hello
I need to schedule a task at the level of the database to rebuild the index online each month. all script exist? as the procedure to call on every month to rebuild indexes for the 5 tables identified in our project?
It is in production
We run in oracle 10g in the solaris platform.Dear Raman,
I have no why yon need this.
Try this, you can change next_date and interval you condition
declare VJOBNUMBER BINARY_INTEGER; begin DBMS_JOB.SUBMIT( job => VJOBNUMBER, NEXT_DATE => sysdate, interval => 'SYSDATE + 30', WHAT => 'BEGIN FOR S IN (SELECT ''alter index'' || INDEX_NAME || '' rebuild;'' A FROM ALL_INDEXES) LOOP EXECUTE IMMEDIATE S.A; END LOOP; END;'); DBMS_OUTPUT.PUT_LINE('Job number assigned: ' || TO_CHAR(VJOBNUMBER)); end;
-
I can add page numbers and the name of the file to several PDF automatically?
Hello. First of all thank you for taking the time to read this! We are a small non-profit hospice. Looking to take a large amount of files and put the family name of patients (which is the name of the file) and a page number in the footer of each page of each document. For example. Smith of file name. Smith Smith Smith 2 1 3 etc. However, I can do this to several files at the same time and do not have to open each one.
I don't understand... Are the names of your files, Smith, Jones, Potter.
etc. ?
If Yes, then you should see a watermark on each page of the output files
saying: 1 Smith, Smith 2, Jones 1, 2 Jones, Potter 1, 2 Potter, etc. Is not
as what you see?
Maybe you are looking for
-
iPhone that does not refresh Plus 6
My iPhone will not refresh Plus 6. I have tried since the new update came out. It gives me just this message: can anyone help?
-
How adapter works with a 2009 MacBook?
I have a 13 "MacBook, to 2009, which has lost its charger and is completely discharged. I tried to reload with a charge adapter MacBook Air 2012, without success. What load adapter is likely to work?
-
Cut and paste tabs and "returns"?
Hello In an earlier version of pages, I could copy and paste tabs, as well as breaks line or "go back". I use this feature a lot then the processor who ends up going inside a spreadsheet and visca versca. In the most recent version of Pages, I think
-
I am trying to remove the older versions of windows to free up space
shows windows xp and me and I try to remove me so I can install xp updates keeps showing not enough disk space to install updates
-
We had WIN XP pro on a computer, but then uninstalled and installed Win 7. We can now use the uninstalled version of Win xp Pro on another computer? Key # [redacted]