Copy link to clipboard
Copied
I am trying to take the selected text, sort it alphabetically, then duplicate all the text so it comes out in a list form.
So if I had the following text selected....
And ran my script....which I have just a vague start on...
#target illustrator
var doc = app.activeDocument;
var selectedItems = doc.selection;
var alphaList = [];
for (i = 0; i < selectedItems.length; i++){
alphaList.push(selectedItems);
}
alphaList.sort();
The results would be this....
Anyone have any guidance for me? Thanks in advance!
Hi subieguy2‌,
it's not the best way, but it is a way:
...#target illustrator
// https://forums.adobe.com/thread/1880702
// Alphabetize text frames, duplicate and make a list in order
var doc = app.activeDocument;
var selectedItems = doc.selection;
var alphaList = [];
for (i = 0; i < selectedItems.length; i++){
if (selectedItems.typename == "TextFrame") {
alphaList.push(selectedItems.contents);
}
}
alphaList.sort();
var aTF = doc.textFrames.add();
aTF.position = [
Copy link to clipboard
Copied
Hi subieguy2‌,
it's not the best way, but it is a way:
#target illustrator
// https://forums.adobe.com/thread/1880702
// Alphabetize text frames, duplicate and make a list in order
var doc = app.activeDocument;
var selectedItems = doc.selection;
var alphaList = [];
for (i = 0; i < selectedItems.length; i++){
if (selectedItems.typename == "TextFrame") {
alphaList.push(selectedItems.contents);
}
}
alphaList.sort();
var aTF = doc.textFrames.add();
aTF.position = [0,0];
aTF.contents = alphaList.join("\r");
Have fun
Copy link to clipboard
Copied
Works like a charm! Thanks so much pixxxel schubser‌!
Find more inspiration, events, and resources on the new Adobe Community
Explore Now