Highlighted

Collect the font, link and color name using Script

Community Beginner ,
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)

 

Adobe Community Professional
Correct answer by Laubender | Adobe Community Professional

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 )

TOPICS
Scripting, SDK

Views

65

Likes

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

Collect the font, link and color name using Script

Community Beginner ,
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)

 

Adobe Community Professional
Correct answer by Laubender | Adobe Community Professional

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 )

TOPICS
Scripting, SDK

Views

66

Likes

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
Jul 24, 2020 0
Adobe Community Professional ,
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 )

Likes

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
Reply
Loading...
Jul 24, 2020 1
Adobe Community Professional ,
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 )

Likes

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
Reply
Loading...
Jul 24, 2020 1
Community Beginner ,
Jul 25, 2020

Copy link to clipboard

Copied

Thanks Laubender,

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

 

Likes

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
Reply
Loading...
Jul 25, 2020 0