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

Automatically create hyperlinks with a script

New Here ,
Sep 23, 2018 Sep 23, 2018

Copy link to clipboard

Copied

Hello

I have created a catalog in indesign with about 8000 Articles in it. The Cataloge looks similar to this:

Article #
Name
Price
8762903Article 118 $
8456901Article 27 $

Later I want to export the whole catalog as a PDF Document and want that my customers can click on every article number in the PDF Document and are getting redirected automatically to my online shop. The Shop URL looks like this: https://www.testshop.com/*Article​Number*

Can someone please help me creating a Script, which automatically searches in the indesign Document for all Article Numbers (Always starting with the number 8 and then have 6 more digits) and add a hyperlink to the correct URL (https://www.testshop.com/*ArticleNumber*)?

I really hope someone could help me, as I am trying to solve this problem for days.

Thank you so much!

TOPICS
Scripting

Views

5.9K

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
Guide ,
Sep 23, 2018 Sep 23, 2018

Copy link to clipboard

Copied

Hi,

I exactly wrote such a script for a client several months ago.

If Interested, you could contact me! …

Best,

Michel, for FRIdNGE

michel.allio.fridnge@gmail.com

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 ,
Sep 23, 2018 Sep 23, 2018

Copy link to clipboard

Copied

If you are using OSX this AppleScript works on the sample text you posted. The URLs are formattted like this: https://www.testshop.com/*8762903

tell application "Adobe InDesign CC 2018"

    activate

    tell active document

        -- finds all 7 digit numbers

        set fg to my GrepSearch("\\d{7}")

      

        --hyperlink each number.

        repeat with x in fg

            set t to contents of object reference of x

            set hs to make hyperlink text source with properties {source text:x}

            set hl to make hyperlink URL destination with properties {destination URL:"https://www.testshop.com/*" & t}

            set h to make hyperlink with properties {source:hs, destination:hl}

        end repeat

    end tell

end tell

on GrepSearch(f)

    tell application "Adobe InDesign CC 2018"

        set find grep preferences to nothing

        set find what of find grep preferences to f

        return find grep

    end tell

end GrepSearch

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
Guide ,
Sep 23, 2018 Sep 23, 2018

Copy link to clipboard

Copied

Hi Rob,

Use  \b8\d{6}\b  Better!

My Script [Javascript => Mac & Windows] uses the F/R window to test the code and, when you launch the script, the 2 codes are directly pasted in the UI as last control:

Capture d’écran 2018-09-23 à 22.13.16.png

Just play "OK"! That's all!

Capture d’écran 2018-09-23 à 22.13.58.png

The script includes a progress bar [useful with thousands of hyperlinks to be created], a final counter [just to say: "Wow! … " ] and a global undo.

Note: if you add more product references, just run again the script: no interference with the job already done. The script just creates other new hyperlinks.

Best,

Michel

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
Enthusiast ,
Sep 23, 2018 Sep 23, 2018

Copy link to clipboard

Copied

Kris from Rorohiko wrote a great javascript for someone at CreativePro Week this past June. It uses GREP to find the string, then plops the found text into a URL. You'll need to configure the GREP and the hyperlink destination (he has instructions in the script and on his blog).
https://www.rorohiko.com/wordpress/use-indesign-find-and-replace-to-assign-hyperlinks-to-text/

EDIT: I'm not sure it works in tables, however. I can't seem to get it to work within a table. But I'll keep trying. I've used it for other searches just fine.

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
Guide ,
Sep 24, 2018 Sep 24, 2018

Copy link to clipboard

Copied

Mine works everywhere, even in the kitchen! … 

Best,

Michel

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
Mentor ,
Sep 24, 2018 Sep 24, 2018

Copy link to clipboard

Copied

royb74794940​

Thread goes to InDesign scripting forum.

Remember, never say you can't do something in InDesign, it's always just a question of finding the right workaround to get the job done. © David Blatner

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
New Here ,
Feb 18, 2020 Feb 18, 2020

Copy link to clipboard

Copied

I have created a catalogue in inDesign with thousand of items in it, starting form an Excel file. I create a QR code using data merge, but I want to export it as a PDF (interactive) and want that customers can click on the QR code (or on the title) and be redirected automatically to my URL (same one that has generated the QR code obviously). Is it possible?

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 ,
Feb 19, 2020 Feb 19, 2020

Copy link to clipboard

Copied

Hi _ross_,

what other interactive features should be in your catalog PDF ?

Should it work with unknown reader software on tablets and mobile devices?

 

Or can you make sure that your audience is using Adobe Reader on Windows or OS X only?

 

Regards,
Uwe Laubender

( ACP )

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
New Here ,
Feb 19, 2020 Feb 19, 2020

Copy link to clipboard

Copied

LATEST

No mobile device needed, I think that desktop use is enough. Dumb down: if you print printing a page you can access to the URL using the QR code, if you take a look at it on your PC, you can click on a button/text/QR and be redirect to the same URL. 

Why can data merge generate a QR code but not embed the same URL as an hyperlink? 

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