• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
9

InDesign Script to create hyperlinks for DOIs

Community Beginner ,
Oct 21, 2023 Oct 21, 2023

Copy link to clipboard

Copied

Hello all,

I need a script that will search for ditital object idenfifier (doi: plus number/letter string) callouts in a documents reference list, apply a hyperlink to it (not changing the text in the ref list), but the hyperlink destination will strip out the "doi:" and replace it with "https//doi.org/" and the string following it. Every doi is different.

 

I hope you can help.?

 

Thanks!

TOPICS
Scripting

Views

287

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 22, 2023 Oct 22, 2023

Copy link to clipboard

Copied

Can you show few, more or less, real examples? Before and after. Screenshot would be enough.

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 22, 2023 Oct 22, 2023

Copy link to clipboard

Copied

Here's an example.

 

DOIs.jpg

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 22, 2023 Oct 22, 2023

Copy link to clipboard

Copied

Is this screenshot from a PC or Mac?

I'm not JS guy so can only write you a VBS script = PC only.

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 22, 2023 Oct 22, 2023

Copy link to clipboard

Copied

PC, thank you!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 23, 2023 Oct 23, 2023

Copy link to clipboard

Copied

You are welcome.

 

Quick question - what would be AFTER those DOIs in the text?

".", ",", " " (space), etc. or nothing, just end of a paragraph? Can they be in the middle of a paragraph?

It's important to know in order to build working GREP expression.

 

And can you share with me - on priv if you prefer - example document for testing - few pages would be enough.

I already have the script - just need to create GREP expression and run few tests, but it would be much easier and quicker to do it on a REAL example...

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Oct 23, 2023 Oct 23, 2023

Copy link to clipboard

Copied

FYI:
GREP expression

doi: (\b10\.\d{4,}\/[-._;()/:A-Z0-9]+\b)

Thanks,
Prabu
Design smarter, faster, and bolder with InDesign scripting.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 23, 2023 Oct 23, 2023

Copy link to clipboard

Copied

quote

FYI:
GREP expression

doi: (\b10\.\d{4,}\/[-._;()/:A-Z0-9]+\b)


By @Anantha Prabu G

 

Why are you making an assumption that all those strings will look exactly the same - will have the same structure? 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Oct 23, 2023 Oct 23, 2023

Copy link to clipboard

Copied

LATEST

Hi @Robert at ID-Tasker

 

I have posted grep experssion for given example, and  checking many varation gerp experssion.

 

Prabu G

Thanks,
Prabu
Design smarter, faster, and bolder with InDesign scripting.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines