Copy link to clipboard
Copied
Hello,
I tinker with scripting but I'm nowhere near a pro.
I need an illustrator script that will find all paths that have no stroke, and delete them.
I feel like this script is really close with a little tweaking:
No Stroke No Fill not recognizing
But I'm having trouble tweaking it properly.
Any help is appreciated. Thanks!!
I think this should do it. Good luck!
...#target illustrator
// it's best practice to wrap everything in a function
// so that you don't accidentally mess up any global
// variables
function RemoveNoStrokePaths() {
// if there are no documents open then return, otherwise
// store a reference to the active document in 'doc'
if( !app.documents.length ) return;
var doc = app.activeDocument;
// store a reference to all the PathItems in the active document
var paths = doc.pathItems;
// Since
Copy link to clipboard
Copied
If you are not confident with scripting, why not use an action script ?
First select some no path object.
Second, create an action
Third, menu/select/same stroke width
Delete
Stop Action recording
On next run, pick a no stroke item, run the action.
I know it's no script and you have to first select some object but you get the job done in a blink
Copy link to clipboard
Copied
I think this should do it. Good luck!
#target illustrator
// it's best practice to wrap everything in a function
// so that you don't accidentally mess up any global
// variables
function RemoveNoStrokePaths() {
// if there are no documents open then return, otherwise
// store a reference to the active document in 'doc'
if( !app.documents.length ) return;
var doc = app.activeDocument;
// store a reference to all the PathItems in the active document
var paths = doc.pathItems;
// Since we might be removing items from the list, the item indices
// could change, and so should loop from the last index to the first
for( var i = paths.length-1; i >= 0; i-- ) {
// get reference to the current PathItem
var curPath = paths;
// if the PathItem has a stroke assigned, the 'stroked' property
// will equal 'true', so if it's false we know that the path
// doesn't have a stroke and we can remove it
if( !curPath.stroked )
curPath.remove();
}
}
RemoveNoStrokePaths();
Copy link to clipboard
Copied
Yes!!
Thank you so much.
Copy link to clipboard
Copied
Thanks, very useful piece of code. Ive add && curPath.filled so i can clean empty items using script and then action