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

Collect the font, link and color name using Script

Contributor ,
Jul 24, 2020 Jul 24, 2020

Copy link to clipboard

Copied

Hi everyone ,

Is there code available to collect the font, link and color names in the active document and not the duplicate of same color or image instead of for example

Link,

Link-1 used in the active document 3 times means the script will find the length and put with the name like

Link-1 (3)

 

TOPICS
Scripting , SDK

Views

232

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

correct answers 1 Correct answer

Community Expert , Jul 24, 2020 Jul 24, 2020

Hm. Just noticed that you tagged your question with "SDK". Is there a particular reason?

My answer's code is written in ExtendScript (JavaScript).

 

Regards,
Uwe Laubender

( ACP )

Votes

Translate

Translate
Community Expert ,
Jul 24, 2020 Jul 24, 2020

Copy link to clipboard

Copied

To get an array of used fonts in a document you can do:

app.documents[0].fonts.everyItem().getElements();

To get all links in the same document the code is similar:

app.documents[0].links.everyItem().getElements();

The resulting array contains font objects, respectively link objects.

You could loop the arrays to get all relevant properties and values if you like.

 

Check the DOM documentation for the objects and property/value pairs:

https://www.indesignjs.de/extendscriptAPI/indesign-latest/#Font.html

https://www.indesignjs.de/extendscriptAPI/indesign-latest/#Link.html

 

Or, you could use the collection of fonts like that and get an array of name values:

app.documents[0].fonts.everyItem().name;

The same with the links:

app.documents[0].links.everyItem().name;

 

FWIW: If you do this with the colors collection of the document, notice, that not every color has a name.

 

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
Community Expert ,
Jul 24, 2020 Jul 24, 2020

Copy link to clipboard

Copied

Hm. Just noticed that you tagged your question with "SDK". Is there a particular reason?

My answer's code is written in ExtendScript (JavaScript).

 

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
Contributor ,
Jul 25, 2020 Jul 25, 2020

Copy link to clipboard

Copied

LATEST

Thanks Laubender,

Actually, it may available in plugin also good thats is the reason

 

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