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

Script for get the used color name in the text and objects

Contributor ,
Jul 27, 2020 Jul 27, 2020

Copy link to clipboard

Copied

Hi Everyone,

I need a script to collect the colors name used in the text and objects of active document. To collect in the log file or append in the same document

TOPICS
Scripting

Views

409

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 27, 2020 Jul 27, 2020

Hi vijayar4612444,

Hans Haesler once wrote a script to remove all unused colors of a document.

Could help you to get the ones that are actually used.

 

UnbenutzteFarbfelder

https://www.hilfdirselbst.org/scripts/downloads.php?groupIDX=&orderby=name&sort=ASC&search_query=&itemIDX=&begin=&limit=&page=0&downloadIDX=157

 

Regards,
Uwe Laubender

( ACP )

Votes

Translate

Translate
Community Expert ,
Jul 27, 2020 Jul 27, 2020

Copy link to clipboard

Copied

Hi Vijay, seems you have mistook the purpose of this forum. You are not supposed to ask for readymade solutions here with just a single statement like "i want this". This is peer to peer forum where people help each other out or ask for suggestions on how to improve upon what they have been working upon. So either come up with a problem statement that shows what you have been working on, like in this case a script that you might have written that does not work as per your needs, someone will look at it and provides suggestions. Or else you are free to browse the forum to search for pieces of code that you can stitch together for your needs. I am sure everything you need for this solution has already been discussed here before, look around collect the pieces and you have a solution.

 

-Manan

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 27, 2020 Jul 27, 2020

Copy link to clipboard

Copied

For your Information,  for learning and get the information purpose only I raised it. I have already searched in the forum about it but i can't get any solutions needed. Maybe if available please share and dont point me like that..

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 27, 2020 Jul 27, 2020

Copy link to clipboard

Copied

This is not how you learn, i gave you a suggestion in good faith but you took it in a wrong way. What did you do so far that we can help you out, did you share any code you wrote? In the other threads also, i see you abandon the thread once someone points you this same thing as i did. It's your wish on how you take it, this way you will drive away responses away from your threads pretty fast.

 

-Manan

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 27, 2020 Jul 27, 2020

Copy link to clipboard

Copied

If you think I have misuse this forum. Not like that and what thread will you share it if I abondon?

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 27, 2020 Jul 27, 2020

Copy link to clipboard

Copied

Again you are misunderstanding me, i never said you misused the forum i said you are not using the forum in a proper way. What i am trying to make you understand is share something that you did try and did not work for you and ask specific issues like "i have written this code it works but so and so case does not work properly can someone help"? If you do it this way, you would have more helping people around. If you just come with question like i need this to be done, you have very slim chances of getting a response as you already must have noticed in this, as well as the previous thread you posted about color where you got asked if you were willing to hire a developer for the job.

 

Also i replied to a previous thread of yours on pdfpresets, i gave you some code you responded with a code yourself which had issues i told you the issues you did not respond back on it since, that gives a wrong indication. The person answering you spends time make good use of it if you can. I am done explaining here for now.

 

-Manan

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 27, 2020 Jul 27, 2020

Copy link to clipboard

Copied

K fine this is my code I tried,

I have able to get the color name used in the objects but I cant able to get the color used in the text.

function myColors(doc){
var myTxtColor = []
for(j=0; j<doc.colors.length; j++){
// myTxtColor.push(doc.stories[j].fillColor.name)
myRectColor.push(doc.rectangles[j].fillColor.name)
}
return [myRectColor]
}
myColorProfile(app.activeDocument)

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 27, 2020 Jul 27, 2020

Copy link to clipboard

Copied

Sorry! called function name is different as above dont considered that.

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 27, 2020 Jul 27, 2020

Copy link to clipboard

Copied

function myColors(doc){
var myTxtColor = []
for(j=0j<doc.colors.lengthj++){
// myTxtColor.push(doc.stories[j].fillColor.name)
myRectColor.push(doc.rectangles[j].fillColor.name)
}
return [myRectColor]
}
myColors(app.activeDocument)

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
Advisor ,
Jul 27, 2020 Jul 27, 2020

Copy link to clipboard

Copied

Hello vijayar4612444 ,

 

you could try this.....

 

 

myTxtColor.push(doc.stories[j].texts.fillColor.name)

 

 

I did not have a chance to test it.

 

Regards

Mike

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 27, 2020 Jul 27, 2020

Copy link to clipboard

Copied

Hi Mike thanks 

 

I tried the code above you mentioned but it got below error.

 

Screenshot 2020-07-27 at 8.10.56 PM.png

 

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 27, 2020 Jul 27, 2020

Copy link to clipboard

Copied

Change texts to texts[0] and then try

 

-Manan

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 27, 2020 Jul 27, 2020

Copy link to clipboard

Copied

LATEST

Hi vijayar4612444,

Hans Haesler once wrote a script to remove all unused colors of a document.

Could help you to get the ones that are actually used.

 

UnbenutzteFarbfelder

https://www.hilfdirselbst.org/scripts/downloads.php?groupIDX=&orderby=name&sort=ASC&search_query=&it...

 

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