Copy link to clipboard
Copied
Hello,
I want to insert a hyperlink on a selected text, I have an error "Error: The selected object is used by another hyperlink."
Use of another script is not enough to clean the indesign documents:
Bonjour,
je veux inséré un hyperlien sur une texte sélectionné, j'ai un erreur "Error: L'objet sélectionné est utilisé par un autre hyperlien."
utilisation d'un autre script ne suffit pas pour nettoyé le documents indesign :
#target "indesign-12.064"
//$.writeln(app.documents.length);
if (app.documents.length > 0) {
for (var i = 0 ; i <app.documents.length; i++) {
app.documents.hyperlinks.everyItem().remove();
app.documents.hyperlinkExternalPageDestinations.everyItem().remove();
app.documents.hyperlinkPageDestinations.everyItem().remove();
app.documents.hyperlinkPageItemSources.everyItem().remove();
app.documents.hyperlinkTextDestinations.everyItem().remove();
app.documents.hyperlinkTextSources.everyItem().remove();
app.documents.hyperlinkURLDestinations.everyItem().remove();
}
}
I do not see my error in the lines of the script here:
je en vois pas mon erreur dans mes ligne du script les voici :
#target "indesign-12.064"
/**********************************
Creation d'une ref sur une ancre
<txtAnchrName />
***********************************/
$.writeln(app.activeDocument.selection[0].parentStory.paragraphs[28].contents);
var destination = app.activeDocument.hyperlinkTextDestinations.add(app.activeDocument.selection[0].parentStory.paragraphs[28]/*possition de l'ancre*/, {name: 'SectionPhilou'}); //creation de l'encre
var xRefForm = app.activeDocument.crossReferenceFormats.item("CTexte de ancre"); // format de la reference
var sourceText = app.activeDocument.selection[0]; // possition ou insertion
try {
var source = app.activeDocument.crossReferenceSources.add(sourceText, xRefForm); /// creation
}
catch (erreur)
{
$.writeln (erreur);
}
var myLink = app.activeDocument.hyperlinks.add(source, destination); ///
//myLink.name ='teste';
//myLink.visible = false;
Thanks for your help, do not speak EN, I work a lot by stages and tests.
Merci pour votre aide, ne parlent pas EN, je travail beaucoup par étapes et de tests .
After research I add the following command:
Suite à des recherches je rajoute la commende suivante :
app.documents.crossReferenceSources.everyItem().remove();
This is enough to remove residual information.
Cela à suffit à supprimé des informations résiduel.
Final code for all deleted (until next problem).
Code final pour tous supprimé (jusqu'au prochain problème).
...#target "indesign-12.064"
//$.writeln(app.documents.length);
if (app.documents.length > 0) {
for (var i = 0 ; i <app.documents.lengt
Copy link to clipboard
Copied
After research I add the following command:
Suite à des recherches je rajoute la commende suivante :
app.documents.crossReferenceSources.everyItem().remove();
This is enough to remove residual information.
Cela à suffit à supprimé des informations résiduel.
Final code for all deleted (until next problem).
Code final pour tous supprimé (jusqu'au prochain problème).
#target "indesign-12.064"
//$.writeln(app.documents.length);
if (app.documents.length > 0) {
for (var i = 0 ; i <app.documents.length; i++) {
app.documents.hyperlinks.everyItem().remove();
app.documents.hyperlinkExternalPageDestinations.everyItem().remove();
app.documents.hyperlinkPageDestinations.everyItem().remove();
app.documents.hyperlinkPageItemSources.everyItem().remove();
app.documents.hyperlinkTextDestinations.everyItem().remove();
app.documents.hyperlinkTextSources.everyItem().remove();
app.documents.hyperlinkURLDestinations.everyItem().remove();
app.documents.crossReferenceSources.everyItem().remove();
}
}
Merci