Running Mac Pro/2.66 GHz—Quad-Core Intel Xeon/Snow Leopard/
OS/Mac OS X Version 10.6.2/2.66 GHz
I converted a CS3 InDesign that uses the script "updatedcrossrefs.js", to CS6 InDesign. This file uses hyperlinks on the TOC and Index.
I tried using the same script for CS3 InDesign in CS6 InDesign but it does not work.
This is the error message "Could not catch page. Check destination names and existence."
Is there an updated script for CS6?
Sorry did not know I was using bold. My co-worker found this script however, she does not work here anymore. But here is the script. I know nothing about scripts except how to use them. Sorry.
// Updatecrossrefs.js
// Updates cross references made with hyperlinks
// the hyperlink destination is where the reference refers to
// the hyperlink sourcetext is the text that will be updated (like see xx)
// If a book is open, the book will be handled,
// if no book is open, the active document will be handled.
// Made by Teus de Jong, last version April 10, 2006
// Revisions by Dave Saunders January 22, 2006 and March 20, 2006
// Thanks Dave!
// Added unique naming mechanism for sources -- October, 2008
if (app.books.length == 0){
if (app.documents.length == 0){
errorExit('No documents are open');
} else {
nrofdocs = 1;
doc = app.activeDocument;
}
} else {
nrofdocs = app.books[0].bookContents.length;
for (i = nrofdocs - 1; i > -1; i--) {
if (app.books[0].bookContents[i].status != BookContentStatus.documentIsOpen)
app.open(File(app.books[0].bookContents[i].fullName));
}
doc = app.open(app.books[0].bookContents[0].fullName);
}
for (d = 1; d <= nrofdocs; d++){
for (i = 0; i < doc.hyperlinks.length; i++){
hyper = doc.hyperlinks[i];
// leave ID's own internal markers alone
if (hyper.name.substring(0, 1) == '.'){continue}
// leave hyperlinks to URLs alone
try {
if (hyper.destination.constructor.name == 'HyperlinkURLDestination'){continue}
} catch (e) {
hyper.showSource();
errorExit('Selected hyperlink has undefined destination');
}
s = hyper.source.name;
// added October, 2008
// sometimes ID's unique name mechanism for sources fails; make sure the source has
// the same name as the hyperlink + '_src'
if (s != hyper.name + '_src')
hyper.source.name = hyper.name + '_src';
if (hyper.destination.constructor.name == 'HyperlinkTextDestination'){
s = getParentPageName(hyper.destination.destinationText);
} else {
// try/catch added to allow for hyperlinks that have lost their destination -- Dave
try {
s = hyper.destination.destinationPage.name;
} catch (e) { continue }
}
if (s != ''){
// Check to see if update needed; saves a lot of time when processing large books -- Dave
if (hyper.source.sourceText.contents != s) {
hyper.source.sourceText.contents = s;
}
}
}
if (d >= nrofdocs){
break;
}
doc = app.open(app.books[0].bookContents[d].fullName);
}
function getParentPageName(txt){
try {
var myFrame = getParentTextFrame(txt);
var pag = myFrame.parent;
while (pag.constructor.name != 'Page'){
// in case the reference is in an inline, the parent of the frame is a character
if (pag.constructor.name == 'Character'){
pag = getParentTextFrame(pag);
}
// in case the chain goes sour, back out
if (pag.constructor.name == 'Application'){
throw 'Error';
}
pag = pag.parent;
}
return(pag.name);
}
catch (e) {
alert('Could not catch page.\nCheck destination names and existence.');
return('');
}
}
function getParentTextFrame(x){
if(app.version == 3){
return(x.parentTextFrame);
}
else {
return(x.parentTextFrames[0]);
}
}
function errorExit(s){
alert(s);
exit();
}
This looks like a URL:
http://softkumir.ru/cgi-bin/eng/soft.cgi?act=more&id=1311041196
North America
Europe, Middle East and Africa
Asia Pacific