2 Replies Latest reply on Feb 19, 2013 2:06 PM by HanielMoore

    Place item from Indesign library using applescript - how?

    HanielMoore

      I am trying to write a script that adds a slug area, then places an item from an indl file. I have had a good search and this is what I have come up with. If I remove the red then it adds a layer and slug area. I just can't manage to place the item from the library. Hopefully someone can help.

       

      Note: the indl file is on my desktop.

       

      My script:

       

      tell application "Adobe InDesign CS5"

                tell document preferences of active document

                          set slug right or outside offset to "100mm"

                end tell

                set myDocument to active document

                tell active document

                          set myLayer to make layer

                          set name of myLayer to "Slug"

                          set placedAsset to place asset asset "Slug" of library "Slug.indl" on myDocument

                          select placedAsset

                          move to {100, 100}

                set locked of myLayer to true

                end tell

      end tell

        • 1. Re: Place item from Indesign library using applescript - how?
          Muppet Mark Level 5

          You are asking ID to place an asset on a document of a document this is not possible… Place your asset from application level to the document… Then you can continue to work at document level later…

           

          tell application "Adobe InDesign CS5"

                    tell document preferences of active document

                              set slug right or outside offset to "100mm"

                    end tell

                    set placedAsset to asset "Slug" of library "Slug.indl"

                    set myDocument to active document

            place asset placedAsset on myDocument

                    tell myDocument

                              set myLayer to make layer

                              set name of myLayer to "Slug"

                              set locked of myLayer to true

                    end tell

          end tell

          • 2. Re: Place item from Indesign library using applescript - how?
            HanielMoore Level 1

            Hey, thanks for your help!

             

            I have now got it to open the library, place the item on a new layer, lock the layer and close the library. I can't however get it to place on all pages or align to the lower right of the page in the slug area. How would I do this?

             

            My script:

             

            tell application "Adobe InDesign CS5"

                      set myDocument to open "/Slug.indl"

                      set myDocument to active document

             

             

                      tell document preferences of active document

                                set slug right or outside offset to "100mm"

                      end tell

             

                      tell myDocument

                                set myLayer to make layer

                                set name of myLayer to "Slug"

                      end tell

             

                      set placedAsset to asset "Slug" of library "Slug.indl"

              place asset placedAsset on myDocument

             

                      tell myDocument

                                set locked of myLayer to true

                      end tell

             

                      set myLibrary to library "Slug.indl"

                      tell myLibrary to close

            end tell