Created
December 30, 2012 01:22
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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