A very simple script that will flip-flop fills into strokes and visa versa.
Specifically for a selection of items that have different colored fills/strokes, instead of selecting each individually this script takes care of it.
**UPDATE**
I've uploaded a non-Scriptographer version of this script here as well "illustrator_MultipleStrokeFillSwap.jsx" this can be used within Illustrator via File > Scripts > Other Script...
Otherwise if you're using Scriptographer still, download the original "strokefill_0_5.js"
Ken
why not use the shortcut Shift+X for this? lol
Maybe because he did not know about it?
I think there are nicer ways to point out that a certain functionality is already contained in the software than this. Let's stay friendly here.
thats why: ....specifically for a selection of items that have different colored fills/strokes....
Shift + X doesn't apply to multiple objects with variant colors.
i.e: box with blue fill and black line, and box with blue fill and red line ... shift + X will not apply to all of them in a single instance,
let's you have 200 of these objects to flip, i'm sure "LOL" won't the first thing that would slip into your mind.
I haven't used this script yet but I am assuming this is the purpose; and if it is, it's super useful for so many designers and illustrator's so I don't think there's much to laugh at.
big ups to lehni for this project and frederickk for this script.
Has anyone gotten this to work yet? no luck for me.
Getting following error in the dialog box
TypeError: Cannot find function getMatchingItems in object Document @638d400.
at Scriptographer Scripts\stroke_-_fill_0_2-previous.js:15
Let me know
Sure it works. Have you tried the 0.4.2 version?
Yes i'm testing on version 0.4.2 and I'm getting no results.
Ive tested example scripts and they are working fine so java is running fine, any advice?
I've cleaned out extraneous code, tested on CS5, and re-uploaded above as version 0.5. Let me know, if this solves your issue.
Ken
- --
However, since this script is pretty simple, here's the code in Adobe's native ExtendScript:
// save the following code with the extension .jsx
// not debugged, but works for me
// and place it in (Mac) Adobe Illustrator CS*/Presets/en_EN/Scripts
// restart illustrator
// now it's visible under File -> Scripts
var sel = app.activeDocument.selection;
for( var i=0; i<sel.length; i++ ) {
var obj = sel[i];
// grouped
if( obj.pathItems != undefined ) {
for( var j=0; j<obj.pathItems.length; j++ ) {
swapStrokeFill( obj.pathItems[j] );
}
}
// singular
else {
swapStrokeFill( obj );
}
}
function swapStrokeFill(obj) {
var tempStrokeColor = obj.strokeColor
var tempFillColor = obj.fillColor
if(obj.strokeColor != null && obj.fillColor == null) {
obj.fillColor = tempStrokeColor;
obj.strokeColor = null;
}
else if(obj.strokeColor == null && obj.fillColor != null) {
obj.strokeColor = tempFillColor;
obj.fillColor = null;
}
else if(obj.fillColor != null && obj.strokeColor != null) {
obj.strokeColor = tempFillColor;
obj.fillColor = tempStrokeColor;
}
};
Thank you, Works great
I created the file myself with your code.