Skip to content

Instantly share code, notes, and snippets.

@clhenrick
Created December 30, 2012 01:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save clhenrick/4410384 to your computer and use it in GitHub Desktop.
Save clhenrick/4410384 to your computer and use it in GitHub Desktop.
a Scriptographer script that will select all text items that match the same character style (typeface, point size, color.) of an already selected text item.
//select text that has the same font and font fill color as the current text selection.
//Point size, tracking, and leading may vary and should not be considered parameters.
//tell illustrator to use the selected text item to copy the characterStyle.font and
//characterStyle.fillColor properties from.
var matchThis = document.getItems({
type: 'TextItem',
selected: true,
});
//set the variable to the first instance of the array
matchThis = matchThis[0];
//set variable for text to look through
var sel = document.getItems({
type: 'TextItem',
selected: false,
});
console.log("Selected Items" + '\r' + sel);
//select all text that has the same character style
for (i=0;i<sel.length;i++) {
if (sel[i].characterStyle.font == matchThis.characterStyle.font) {
if (sel[i].characterStyle.fillColor == matchThis.characterStyle.fillColor){
if (sel[i].characterStyle.fontSize == matchThis.characterStyle.fontSize){
sel[i].selected = true;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment