Copy link to clipboard
Copied
Hello! Is there a way i can batch render to remove all existing hyperlinks in multiple in design files?
Copy link to clipboard
Copied
in the future, to find the best place to post your message, use the list here, https://community.adobe.com/
p.s. i don't think the adobe website, and forums in particular, are easy to navigate, so don't spend a lot of time searching that forum list. do your best and we'll move the post (like this one has already been moved) if it helps you get responses.
<"moved from cc desktop">
Copy link to clipboard
Copied
Hello! Is there a way i can batch render to remove all existing hyperlinks in multiple in design files?
By @darbyMan
Can you please clarify:
Do you just want to remove all hyperlinks in multiple InDesign files? That is, by "render" you just mean batch process.
If by "render" you mean something else, then please explain what it is.
Copy link to clipboard
Copied
Something like this on a folder of InDesign files
Might be slow on many files - could be an option to work blind without 'opening' the file but having issues getting it done.
It's a start if anyone else can help with it.
var folder = Folder.selectDialog("Select folder with InDesign files");
if (folder != null) {
var files = folder.getFiles("*.indd");
for (var i = 0; i < files.length; i++) {
var doc = app.open(files[i]);
// remove hyperlinks
while (doc.hyperlinks.length > 0) {
doc.hyperlinks[0].remove();
}
// save & close
doc.save();
doc.close();
}
}
Then there might be this approach - but I'm running it and it's not removing the hyperlinks ... hmmmm
Anyone help? The optional part isn't working - surely it should give the option... anyway some building blocks to play with.
/**
* Batch Remove Hyperlinks from InDesign files
* -------------------------------------------
* - Removes all hyperlinks, hyperlink text sources, and destinations
* - Handles shared destinations safely
* - Clears hyperlink character styles (optional)
* - Backs up originals into a "_Backup" folder
* - Logs actions to "HyperlinkRemovalLog.txt"
*
* Inspired by scripts from Kasyan Servetsky, and others via Creative Pro
* Adobe forums, and GitHub script repositories.
*/
(function () {
// === CONFIG ===
var CLEAR_FORMATTING = true; // true = clear hyperlink char styles
var BACKUP_FILES = true; // true = copy originals before editing
var LOG_RESULTS = true; // true = write a log file
// ==============
// Select folder
var folder = Folder.selectDialog("Select folder with InDesign files");
if (!folder) return;
// Setup backup + log
var backupFolder = new Folder(folder.fsName + "/_Backup");
if (BACKUP_FILES && !backupFolder.exists) backupFolder.create();
var logFile;
if (LOG_RESULTS) {
logFile = new File(folder.fsName + "/HyperlinkRemovalLog.txt");
logFile.open("w");
logFile.writeln("Hyperlink Removal Log");
logFile.writeln("Run on: " + new Date());
logFile.writeln("----------------------------------------");
}
var files = folder.getFiles("*.indd");
for (var i = 0; i < files.length; i++) {
var f = files[i];
try {
if (!(f instanceof File) || !f.exists) continue;
if (BACKUP_FILES) {
f.copy(backupFolder.fsName + "/" + f.name);
}
var doc = app.open(f, false);
var removedCount = 0;
// === Clear formatting (optional) ===
if (CLEAR_FORMATTING && doc.characterStyles.itemByName("Hyperlink").isValid) {
var hlStyle = doc.characterStyles.itemByName("Hyperlink");
var stories = doc.stories;
for (var s = 0; s < stories.length; s++) {
stories[s].texts[0].applyCharacterStyle(app.activeDocument.characterStyles.itemByName("[None]"), true);
}
}
// === Remove hyperlinks safely ===
for (var h = doc.hyperlinks.length - 1; h >= 0; h--) {
try {
doc.hyperlinks[h].remove();
removedCount++;
} catch (e) {
// continue
}
}
// === Remove leftover destinations ===
for (var d = doc.hyperlinkDestinations.length - 1; d >= 0; d--) {
try {
doc.hyperlinkDestinations[d].remove();
} catch (e) {
// skip shared ones in use
}
}
// === Remove leftover sources ===
for (var s = doc.hyperlinkTextSources.length - 1; s >= 0; s--) {
try {
doc.hyperlinkTextSources[s].remove();
} catch (e) {
// skip errors
}
}
doc.save();
doc.close();
if (LOG_RESULTS) {
logFile.writeln(f.name + " — hyperlinks removed: " + removedCount);
}
} catch (err) {
if (LOG_RESULTS) {
logFile.writeln(f.name + " — ERROR: " + err);
}
}
}
if (LOG_RESULTS) {
logFile.writeln("----------------------------------------");
logFile.writeln("Done.");
logFile.close();
}
alert("Batch process complete.\nCheck the log file for details.");
})();
Will revisit later - looking forward to knowing more and working out the kinks.
Copy link to clipboard
Copied
Something like this on a folder of InDesign files
Might be slow on many files - could be an option to work blind without 'opening' the file but having issues getting it done.
By @Eugene Tyson
Maybe @Kasyan Servetsky's batch processor can help:
https://kasyan.ho.ua/indesign/batch_process_scripts/batch_process_scripts.html
Find more inspiration, events, and resources on the new Adobe Community
Explore Now