Copy link to clipboard
Copied
PathItems doesn't have the method to find if a path has a fill, which is what I must know ?
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.
Copy link to clipboard
Copied
Yea they do, where do you go to to find these properties? You can see them in the ESTK OMV. The property is "filled".
Copy link to clipboard
Copied
I look in the Javascript ref guide (pdf) is it not listed in this guide ? I think it's defaultFilled;
app.document.defaultfilled = true;
Copy link to clipboard
Copied
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!
Copy link to clipboard
Copied
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 ?
Copy link to clipboard
Copied
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
![]()
Copy link to clipboard
Copied
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 ?
Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
I think target specific activeDocument[0] was causing problems.
Copy link to clipboard
Copied
Must I know the color of a path fill to apply noColor ?
app.activeDocument.fillColor = noColor;
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Please, read my post again – carefully!
Copy link to clipboard
Copied
Arghh I forgot the index, I have to do something else to that code ![]()
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
I forgot to mention that in my post.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more