Skip to content

Instantly share code, notes, and snippets.

@dulldesk
Created October 2, 2022 19:23
Show Gist options
  • Save dulldesk/2bf7168eb4fd4624dbba0c8893c9aab4 to your computer and use it in GitHub Desktop.
Save dulldesk/2bf7168eb4fd4624dbba0c8893c9aab4 to your computer and use it in GitHub Desktop.
Adobe Illustrator script to count the number of words in the document
//@target illustrator
// app.preferences.setBooleanPreference('ShowExternalJSXWarning', false);
const app_dir = app.activeDocument.path;
function main() {
if (!documents.length) {
alert('Error\nOpen a document and try again');
return;
}
var textRefs = app.activeDocument.textFrames;
var cnt = 0;
for (var i=0; i<textRefs.length; i++) {
cnt += textRefs[i].contents.split(" ").length;
}
alert("Count: " + cnt);
}
main();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment