Skip to main content
Echris7733130
Known Participant
Oct 13, 2026 5:36 PM UTC
Question

Looking for a script that can look at text with specific paragraph style, then go to a website, search it, grab the specific url result and then hyperlink the text in that paragraph style, possible?

Looking for a script or create one where I can run it based on paragraph style. Essentially anything with that style, it would go to a website I want it to, search the site, find the result and grab the url and hyperlink the text in that style. An example would be looking for bible passages based on whether it be niv, esv, etc. the script would run on text in a style, a passage then search on the site I want it to, with say niv selected and then grab the result and hyperlink the text. Anyone seen anything like this? Script the best approach or something else?

 

Thanks.

    12 replies

    Echris7733130
    Known Participant
    Oct 14, 2026 5:56 PM UTC

    Thanks for all the comments on this, lot to think about. Sorry for missing info, on Mac, only use safari, won’t touch chrome anymore. Thanks for the AI suggestion, but pass on using that at all, more curiosity about whether this could be done and it looks like some ways exist that it could, but a lot to take into consideration on how to do it and whether it may even be worth it.

    Translate
    rob day
    Community Expert
    Community Expert
    Oct 14, 2026 7:40 PM UTC

    I think you will have to use AppleScript. Safari has an AppleScript dictionary—this launches Safari and opens www.google.com

     

     

    tell application "Safari"
    activate
    open location "https://www.google.com"
    end tell

     

    Translate
    Community Expert
    Oct 14, 2026 5:11 AM UTC

    I’ve been tinkering with scripts that interact with Chrome to some success, but it’s not easy and painstaking, because I don’t know what I’m doing. But I’m getting there for my needs, so initially my thoughts are YES it can be done, because I am doing it, maybe badly, but it’s working. 
     

    Depending on the website, you might not even need to search it. Some websites use predictable URL structures, so the script could generate the correct URL directly from the text.

    For example, if a paragraph contains a Bible reference like John 3:16, the script could construct the URL using that reference and the required translation (NIV, ESV, etc.), then automatically hyperlink the text in InDesign. So the script only needs to construct the URL from the text, which is easier.

    The script could look for a specific paragraph style, read the text, generate the URL and apply the hyperlink. That would be much simpler and more reliable than searching a website and extracting links from the results.

    If the website doesn't use predictable URLs, then searching and retrieving the correct result would be more complicated, but potentially still possible.

    A couple of questions:

    • Which website are you actually trying to link to?

    • Does each paragraph contain only the text you want hyperlinked, or is it part of a larger paragraph?

    • Are the URLs predictable, or does the script genuinely need to search the website to find the correct result?

    Those details would help determine the best approach.

    Translate
    rob day
    Community Expert
    Community Expert
    Oct 14, 2026 3:04 PM UTC

    Hi ​@Eugene Tyson , Curious, are you writing in ExtendScript? What method do you use to launch Chrome and open a URL?

    Translate
    Community Expert
    Oct 14, 2026 4:31 PM UTC

    Something like this


    var url = "https://www.google.com";

    app.doScript(
        'tell application "Google Chrome" to open location "' + url + '"',
        ScriptLanguage.APPLESCRIPT_LANGUAGE
    );
     

    Translate
    rob day
    Community Expert
    Community Expert
    Oct 13, 2026 6:37 PM UTC

    Hi ​@Echris7733130 , Adobe’s scripting languages ExtendScript (.jsx) and UXP (.idjs) are limited to Adobe applications, so I don’t think you will be able to open and script a browser via ExtendScript or UXP.

     

    If you are on MacOS, AppleScript can communicate between AppleScript enabled applications (i.e. InDesign and Safari), but what you are describing would not be easy.

    Translate
    leo.r
    Community Expert
    Community Expert
    Oct 13, 2026 6:47 PM UTC

    ​@rob day In theory, it’s also possible to perform search via command line tools without dealing with the browsers (as I’m sure you know anyway). But I don’t know if ExtendScript or UXP can communicate with them as efficiently as AppleScript can. As far as I understand, VisualBasic on Windows is more suitable for this (and can also be used to script InDesign). I don’t have any direct experience with this.

    Regardless, like you said, it’s not an easy task either way.

    Translate
    rob day
    Community Expert
    Community Expert
    Oct 13, 2026 9:13 PM UTC

    The ExtendScript core JS lets you make a TCP/IP connection via Socket, but I don’t think that helps ​@Echris7733130 ?

     

    https://www.indesignjs.de/indesignapi/javascript/Socket.html

     

    Translate
    leo.r
    Community Expert
    Community Expert
    Oct 13, 2026 6:06 PM UTC

    In my view, for this particular script you have two options:

    -Feed your request to an AI tool. It will, definitely, produce an initial script for you. However, if you’re not a developer, then tweaking this script, even with AI, until it does something useful may prove to be more trouble than you wish to deal with.

    OR

    -Hire a developer who’d write the script for you. If someone here on the forum would like to offer this service, I’m sure they’ll let you know one way or another. (In theory, I could also produce such a script, but right now I can’t allocate any time for this, unfortunately.)

    Translate