0

There is a standard script to sort multiple paragraphs alphabetically in InDesign, but I am looking for a script to sort words within a single paragraph alphabetically. Does anyone know of such a script?

4

Not aware of such a script but it's very easy to combine a selection Grep Find/Change with SortParagraphs.jsx

Select your paragraph, open the Find/Change panel.
In the Grep tab, replace spaces by paragraph returns. Find \s, change \r
Make sure to change selection only.

With all the content still selected, run the SortParagraphs script, then revert the process by changing paragraph returns by spaces.

enter image description here

0

A friend of mine has provided me with the answer: app.selection[0].contents = app.selection[0].contents.split(/\s+/).sort().join(" ") Thanks to Harbs.!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.