-
1. Re: [JS] CrossReference using Text Anchor of another file
Philippe Ruelle Dec 2, 2012 11:14 AM (in response to Philippe Ruelle)Hi,
I advance the principle function but I have a problem with the line 51, and my knowledge of code is not very good.
Here is the error message: The selected object is being used by another Hyperlink.
Thank you for help can
translationBonsoir,
J'avance, le principe fonction mais j'ai un problème à la line 51, et ma connaissance des code n'est pas très bonne.
Voici le message d'erreur : L'Objet sélectionné est utilisé par un autre Hyperlien.
Merci pour un peux d'aide
#target indesign
/*
Ouverture du livre et des fichiers pour les encre
*/
// Variable globales p
var leFichier01 = "106_TVA_OK3.indd";
var leFichier02 = "107 TVA ok1.indd";
var leFichier03 = "108 TVA ok1.indd";
var leFichier04 = "113 TVA chrono.indd";
var lesFichiers01 = [leFichier01,leFichier02,leFichier03];
main();
function main(){
if(app.documents.length != 0){
if(app.selection.length != 0 && app.selection[0].constructor.name == 'Table'){
var nomTableau = app.selection[0];
dirTVA_2012_deux(nomTableau);
exit();
}
else{
alert("Selection un tableau");
exit();
}
}
else{
alert("Ouvrait un document et Mettre son cuseur dans le points de départ");
exit();
}//
}//
function dirTVA_2012_deux(leTableau_Chono){
app.findGrepPreferences = NothingEnum.nothing;
app.changeGrepPreferences = NothingEnum.nothing;
with (leTableau_Chono.columns[2]) {
for (var tab = 0; tab < cells.length; tab++) { // sue toutes la colonnes
//for (var tab = 0; tab < 9; tab++) { // sur 10 cell pour le test
// faire une boucle par documents
if (cells[tab].contents != null) {
app.findGrepPreferences.findWhat = cells[tab].contents; // remplacer le 1 par le conteur de colonnes "tab" conteur de cell
for (var conteurFich = 0; conteurFich < lesFichiers01.length; conteurFich++){
var leResultat = [];
leResultat = app.documents.itemByName(lesFichiers01[conteurFich]).findGrep();
// pas de IF le test est dans la boucle for!!
for (var b = 0; b < leResultat.length; b++) {
var s = leTableau_Chono.columns[3].cells[tab].insertionPoints.firstItem(); // MON Problème est làà!!!!!!
var cr_destination = app.documents.itemByName(lesFichiers01[conteurFich]).hyperlinkTextDestinations.add(leResu ltat[b], { name: leResultat[b].contents + "_"+ conteurFich + "_" +b});
var cr_format = app.documents.itemByName(leFichier04).crossReferenceFormats.itemByName('Philou007');
var cr_source = app.documents.itemByName(leFichier04).crossReferenceSources.add({sourceText:s, appliedFormat: cr_format} );
var cr = app.documents.itemByName(leFichier04).hyperlinks.add ( cr_source, cr_destination);
} // fin du For su r "leResultat"
} // fin du FOR sur les fichier "lesFichiers01"
} // fin du If test cell vide
} // fin du For sur les cell
}// fin du with tableau
}// fin de la function
-
2. Re: [JS] CrossReference using Text Anchor of another file
[Ariel] Dec 2, 2012 11:55 AM (in response to Philippe Ruelle)This is probably a leftover from the last time you ran the script. In
other words, the text that you are trying to convert to a
hyperlinkTextSource is already being used.
I haven't followed this thread from the beginning, but to clear all
hyperlinkTextSources in a document use:
app.activeDocument.hyperlinkTextSources.everyItem().remove()
Hope that's helpful. It's probably not an exact answer for you, but
perhaps it points you in the right direction.
Ariel
-
3. Re: [JS] CrossReference using Text Anchor of another file
Philippe Ruelle Dec 2, 2012 2:17 PM (in response to [Ariel])Thank you, Ariel,
For your answer, there is already this site a HyperLink I have kept, I have to put another before or after. this is the command "var s = leTableau_Chono.columns [3]. cells [tab]. insertionPoints.firstItem ();" which is not good, I have to insert several Hyperlink.
Thank you I'm still looking
Translation (Google) message sourceMerci, Ariel,
Pour votre réponse, il y a déjà à cette emplacement un HyperLink que je dois gardé, je dois y mettre un autre avant ou après. c'est la commande "var s = leTableau_Chono.columns[3].cells[tab].insertionPoints.firstItem();" qui n'est pas bonne, je dois insert plusieurs Hyperlink.
Merci je cherche encore
Traduction (Google) source du message


