Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Alphabetize text frames, duplicate and make a list in order

Engaged ,
Jun 23, 2015 Jun 23, 2015

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....

selected text.JPG

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....

Capture.JPG

Anyone have any guidance for me? Thanks in advance!

TOPICS
Scripting
2.4K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jun 23, 2015 Jun 23, 2015

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 = [

...
Translate
Adobe
Community Expert ,
Jun 23, 2015 Jun 23, 2015

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jun 24, 2015 Jun 24, 2015
LATEST

Works like a charm! Thanks so much pixxxel schubser‌!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines