1 Reply Latest reply on Dec 10, 2013 2:17 PM by pixxxel schubser

    [AS][CS5] Reverse selected text

    JohnDevlon Level 1



      I'm trying to write a script to reverse selected text in Illustrator. Unfortunatly, An error is trown. Does anyone know why?


      The script ...


      tell application "Adobe Illustrator"


          set docRef to the current document

          set selectedItems to selection of docRef 

          set myResult to my myReverse(the text of selectedItems)


          -- Error below

          set the text of selectedItems to myResult


      end tell



      on myReverse(myList)


           set myResult to {}


          set numOfItems to the (count of myList)

          set currentNum to numOfItems


          repeat with i from 1 to numOfItems

              set the end of myResult to item currentNum of myList

              set currentNum to currentNum - 1

          end repeat


          return myResult


      end myReverse



      display dialog "done"

        • 1. Re: [AS][CS5] Reverse selected text
          pixxxel schubser MVP & Adobe Community Professional

          Sorry, I have no experience with AppleScript.

          With Javascript I would do the following:


          // TextReverse.jsx
          // preconditions: an open document with a text frame with text inside (no selection required)
          // regards pixxxelschubser
          var reverseText = app.activeDocument.textFrames[0].contents.split("").reverse().join("");
          app.activeDocument.textFrames[0].contents = reverseText;


          Maybe this helps a little bit.