9 Replies Latest reply on Oct 27, 2014 5:25 PM by Qwertyfly...

    Moving items from a template file to active document

    djbgraphicdesign Level 1

      Hello Everyone,

       

      What I am currently doing is I will leave a template file open and I will have to go to that file really quick and copy what I have selected in that file, go back to the file I am currently working on, then I will use an action that will paste it in the correct place. I was wondering if a script could copy what I have selected in my template file and paste it into my active file so I won't even have to leave my active file. Here is what I have so far.

       

      var template = app.documents.getByName ("sig.ai");

       

      var tempSelected = template.selection;

       

      var docRef = app.activeDocument;

       

       

       

      if ( tempSelected.length > 0 ) {

       

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

       

      newItem = tempSelected[i].duplicate( docRef,

       

      ElementPlacement.PLACEATEND );

       

      }

       

      }

       

      else {

       

      alert( "Please select one or more art objects in your temp file" );

       

      }

       

      It is not working, I just get the alert message, unless my template is my active file too, which does me no good. Not sure if this is possible to do I have trouble finding scripts that involve files other than the active file so I am not sure what all is capable. Thanks for taking the time to look at this for me I really appreciate it. I tried messing around with placing files but it is not editable enough for me to use.