Skip to main content
July 23, 2011
Question

InDesign and Applescript - Another place asset question.

  • July 23, 2011
  • 2 replies
  • 1684 views

I am trying to place an asset on page but am having some problems.  If I have an asset in my library and it has a few items in like a couple text boxes and images and they are grouped together, it places fine but then I have a problem with trying to change styles for any individual items withing that asset because seems to treat group as item 1 of that asset and can't seem to get to reference individual items of asset that has grouped items.  Tried things like "item 1 of placed asset" but treats that like group which is good for move but not when wanting to reference individual items.  When I create placed asset with all individual items ungrouped then it does allow me to apply styles on individual items but then can't move everything to location as a group so allignment all stays correct.  Thinking that maybe I could either ungroup all items in first scenerio after moving then apply styles but not sure how to refernence that group and then the items within that group when ungrouped.  Or, doing second scenerio where load asset ungrouped then apply styles then group and move but since number of items in assets can be different, not sure how to dynamically create group using repeat or something?  Thanks, Joe

             repeat with i from 1 to count csvEntries

                    set csvEntry to csvEntries's item i

                    set {fldElement, fldLocationX, fldLocationY} to csvEntry's text items

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

                        move placedAsset to {fldLocationX, fldLocationY}

   

                    -- apply styles to individual items os asset

                    -- Then, can I create group dynamically for all items in asset if ungrouped?

                    -- set myGroup to make group with properties {group items:{ placedAsset}}???

                    -- then move group to location?

                    -- Or

                    -- can I ungroup asset if comes in already with all items grouped

                    - First, move to location everything as a group then ungroup

                    --    tell placedAsset

                    --           ungroup

                    --    end tell

                    -- Now apply styles to individual items.   

                   

                  

    

This topic has been closed for replies.

2 replies

Participating Frequently
July 27, 2011

I was working on script which uses dialog window. When you run script window with listbox pop up and than you can choose asset with shortcut. This is fastes way for placeing assets from library.

Did you try this

var myplacedasset=app.libraries[libIndex].assets.item(assetName).placeAsset(app.activeDocument);

...

Do what you want to do (apply object syles etc)

...

app.select(myplacedasset);

In this case you don't need to group item, you just select them and move selection to desired position.

John Hawkinson
Inspiring
July 23, 2011

Paragraphs, please.

Tried things like "item 1 of placed asset" but treats that like group which is good for move but not when wanting to reference individual items.

Well, if you want the first item of the group, then you probably want "item 1 of item 1 of placed asset."

July 23, 2011

Thanks, but tried that too but no luck.  Whether I put item 1 of placed asset or item 1 of item 1 of placed asset, same thing and when try item 2 of anything, doesn't recognize it.

Inspiring
July 27, 2011

Have you tried "page item 1 of item 1 of PlacedAsset"?