2 Replies Latest reply on Nov 26, 2014 1:55 AM by newtoindesign

    [JS] CS6 .duplicate to top-left of varying size doc

    newtoindesign

      Hey guys,

       

      I have a script that prompts the user for a code, opens a doc matching that code from a folder of templates, duplicates those contents on the currently already open document (created by another process), then closes the template doc.

       

      It's all working nicely, though the .duplicate() part always places the contents on the template document on the  Left, and Vertically Centered. 
      Is there anyway to make it Top-Left ?

       

      The blank document templates are being pasted on could vary though, so i guess it would involve getting the dimensions of the blank doc and using them in someway?

       

      I see you can specifiy coordinates but 0,0 its always Left, and Vertically Centered, and any other hard-coded numbers might not work for different size docs

      doc1.pages[i].pageItems.everyItem().duplicate(doc2.pages[i],[0, 0]);

       

      Hope that makes sense!