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

InDesign Script to create hyperlinks for DOIs

Community Beginner ,
Oct 21, 2023 Oct 21, 2023

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
468
Translate
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
LEGEND ,
Oct 22, 2023 Oct 22, 2023

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

 

Translate
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

Here's an example.

 

DOIs.jpg

Translate
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
LEGEND ,
Oct 22, 2023 Oct 22, 2023

Is this screenshot from a PC or Mac?

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

 

Translate
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

PC, thank you!

Translate
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
LEGEND ,
Oct 23, 2023 Oct 23, 2023

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...

 

Translate
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

FYI:
GREP expression

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

Thanks,
Prabu
Design smarter, faster, and bolder with InDesign scripting.
Translate
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
LEGEND ,
Oct 23, 2023 Oct 23, 2023
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? 

 

Translate
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
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.
Translate
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