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

Path with fill

Advisor ,
Mar 11, 2017 Mar 11, 2017

PathItems doesn't have the method to find if a path has a fill, which is what I must know ?

TOPICS
Scripting
2.2K
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

correct answers 1 Correct answer

Community Expert , Mar 12, 2017 Mar 12, 2017

Yes. There is never a activeDocument[0]

(like I wrote before)

And last answer by myself:

curDoc.selection[0].filled = false;

or

curDoc.pathItems[0].filled = false;

All of these is a part of basic knowledgebase and you can find hundreds of examples here in forum.

Translate
Adobe
Valorous Hero ,
Mar 11, 2017 Mar 11, 2017

Yea they do, where do you go to to find these properties? You can see them in the ESTK OMV. The property is "filled".

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
Advisor ,
Mar 11, 2017 Mar 11, 2017

I look in the Javascript ref guide (pdf) is it not listed in this guide ? I think it's defaultFilled;

app.document.defaultfilled = true;

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
Participant ,
Mar 12, 2017 Mar 12, 2017

Since each path can have its own fill you need to check the "filled" property of the individual path items.

if( app.activeDocument.pathItems[0].filled )

    alert( "the path has a fill applied!" )

You can then get to the actual fill color by using the "fillColor" property. Same thing for strokes, just change it to "stroked" and "StrokeColor"

In the reference guide, look under the PathItem header.

Good luck!

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
Advisor ,
Mar 12, 2017 Mar 12, 2017

If the activeDocument is within a variable, why can't I use that variable in the condition;

if(VariableNameForActiveDocument.pathItem[0].filled)

Instead I get undefined is not an object ?

Must I specify the first path in the total paths and rather do;

if(VariableNameForActiveDocument.pathItem.filled)

Same thing as previous error; undefined is not an object ?

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 Expert ,
Mar 12, 2017 Mar 12, 2017

There is a typo.

The class is pathItems.

"pathItems" first path item is "pathItems[0]"

That's why try

if(VariableNameForActiveDocument.pathItems[0].filled)

or

if(VariableNameForActiveDocument.pathItems[0].filled == true) 

Have fun

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
Advisor ,
Mar 12, 2017 Mar 12, 2017

If I have this;

curDoc = app.activeDocument[0];

Why can't I use that in the condition;

if(curDoc.pathItems[0].filled == true)

Must I use an array index for pathItems if the paths are already selected ?

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 Expert ,
Mar 12, 2017 Mar 12, 2017

wrong syntax again. sorry

//use

var curDoc = app.activeDocument;

// or use

var curDoc = app.documents[0];

// do you really will find out the filled property of pathItems[0] ???

alert(curDoc.pathItems[0].filled);

// or do you need the property of selections item[0] ???

alert(curDoc.selection[0].filled);

Helps this a little?

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
Advisor ,
Mar 12, 2017 Mar 12, 2017

I think target specific activeDocument[0] was causing problems.

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
Advisor ,
Mar 12, 2017 Mar 12, 2017

Must I know the color of a path fill to apply noColor ?

app.activeDocument.fillColor = noColor;

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 Expert ,
Mar 12, 2017 Mar 12, 2017

Yes. There is never a activeDocument[0]

(like I wrote before)

And last answer by myself:

curDoc.selection[0].filled = false;

or

curDoc.pathItems[0].filled = false;

All of these is a part of basic knowledgebase and you can find hundreds of examples here in forum.

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
Advisor ,
Mar 12, 2017 Mar 12, 2017

I did some searching although I appear to be doing everything correct, and there are no errors in my code.

fillColor = false doesn't actually remove the fill color on the path it's still visible ? Then again NoColor is the same as fillColor=false so I'll ignore NoColor.

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 Expert ,
Mar 12, 2017 Mar 12, 2017

Please, read my post again – carefully!

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
Advisor ,
Mar 12, 2017 Mar 12, 2017

Arghh I forgot the index, I have to do something else to that code

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
Mentor ,
Mar 13, 2017 Mar 13, 2017

No, it's not the index that's the problem.

the property "fillColor" is the name of the color. you can't use "curDoc.pathItems[0].fillColor = false". fillColor is not a boolean, it's the name of a swatch.

use curDoc.pathItems[0].filled = false;

"filled" is the getable/setable boolean property that determines whether or not an item is filled.

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
Advisor ,
Mar 13, 2017 Mar 13, 2017
LATEST

I forgot to mention that in my post.

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