7 Replies Latest reply on Sep 22, 2015 12:22 PM by Laubender

    How to find elements ona pasteboard and place it in a paragraph?




      I have this script that finds a paragraph style, puts an item from a library at the very end and applies object style:


      myDoc = app.documents[0];

      myLib = app.libraries[0];

      myObjectStyle = myDoc.objectStyles.item ("marker");


      app.findTextPreferences = app.changeTextPreferences = null; 

                app.findTextPreferences.appliedParagraphStyle = "Custom"

              var myFound = app.activeDocument.findText(true);

              alert (myFound.length);

      try {

         for (i = 0; i < myFound.length; i++) {

            myIcon = myLib.assets.itemByName("winieta_tr").placeAsset (myFound[i].insertionPoints[-2])[0];

            myIcon.appliedObjectStyle = myObjectStyle;

           // myFound[i].remove ();



      catch (e) {alert (e.message)}



      I don't know how to alter it, so the items are obtained not from library but form pasteboard - any help would be appreciated

      Is it possible to find elements that are in the document by name, as it is with library elements?