Hello Khaled Aly and Kal Starkis,
First of all, thank you very much for your exchange around this topic, it’s been super useful for me and what I am trying to do. From what I understand, the second version of Kal Starkis’ script is exactly what I would need, however I cannot rely on ExtendScript Toolkit so I would need the result of this script to be exported into some format like .txt for example.
The reason for this is that I work in a team where most of my colleagues barely use the Adobe suite, meaning they have access to it but aren’t quite proficient. Among other things, we create ebooks, so for specific tasks (like localizing them into other languages) we need to adapt the linked URLs for the (new) target audience. I am looking for a way to make this easy for them: instead of manually going page by page trying to find all hyperlinks or even via the hyperlink windows in InDesign (sometimes it’s a few hundred URLs), I would like to give them a quick solution to run a script like this on a file and get a list of the used URLs. This list could then be used to find the corresponding links for the localized versions (for example, if an ebook links to a help site like [https://helpx.adobe.com/story/help/add-edit-scripts-.html], we would then know that this link needs to be swapped with this [https://helpx.adobe.com/la/story/help/add-edit-scripts-.html] for the Spanish-language version.
Now I’ve given it a few tries, but I am very unfamiliar with actual editing of Javascript code myself, so I am completely lost. I understand I should be adding these instructions about what to do with the result of the script in the bit that says “for (var key in indexOfURLs) { $.writeln(key + “: ” + indexOfURLs[key]);” but I really don’t know how.
Could someone give me a hand with this? Also, is there a way to then automatically import the URLs back into the InDesign file? For example, if all source URLs are in Column A of a spreadsheet and the Spanish version links are in column B and German in C, can such a spreadsheet be used to automatically swap all links in the InDesign file in order to avoid mistakes by manual work?
Thank you very much for all your help already!