Copy link to clipboard
Copied
Hello,
I'm quite new to InDesign Scripting. I would like to place text frames stored in a Library into another text frame. In InDesign, I would do the following steps:
- Place the text frame from the library
- Create a main text frame
- Ctrl+X the placed item
- Select the main text frame
- Ctrl+V
Having something like this:
I'm currently able to create the text frame and also place the item from the library in the document...
Thanks
Hi kelfas,
then your question is not about the library, but about how to anchor an object?
See here:
textFrame
Adobe InDesign CS6 (8.0) Object Model JS: TextFrame
textFrame.anchoredObjectSettings
Adobe InDesign CS6 (8.0) Object Model JS: AnchoredObjectSetting
textFrame.anchoredObjectSettings.insertAnchoredObject()
Adobe InDesign CS6 (8.0) Object Model JS: AnchoredObjectSetting
You are speaking of "library item".
That's an asset. And assets have method placeAsset() that also accepts text as argument:
Copy link to clipboard
Copied
Hi kelfas,
then your question is not about the library, but about how to anchor an object?
See here:
textFrame
Adobe InDesign CS6 (8.0) Object Model JS: TextFrame
textFrame.anchoredObjectSettings
Adobe InDesign CS6 (8.0) Object Model JS: AnchoredObjectSetting
textFrame.anchoredObjectSettings.insertAnchoredObject()
Adobe InDesign CS6 (8.0) Object Model JS: AnchoredObjectSetting
You are speaking of "library item".
That's an asset. And assets have method placeAsset() that also accepts text as argument:
Adobe InDesign CS6 (8.0) Object Model JS: Asset
Something like this should work, because insertionPoints belong to text:
var myTextFrame = app.documents[0].textFrames.add({geometricBounds : [0,0,100,100]})
app.libraries[0].assets[0].placeAsset(myTextFrame.insertionPoints[0]);
Regards,
Uwe
Copy link to clipboard
Copied
Hi kelfas,
or are you talking about CC Libraries and not an opened InDesign library file with suffix *.indl ?
And you want to place the asset in the loaded placegun to an insertion point of your text frame?
I would recommend this one:
Place the asset and use method insertAnchoredObject() of the placed pageItem's anchoredObjectSettings where you can define where to anchor (e.g. an insertionPoint of a text frame). How you anchor is defined with the anchoredObjectSettings of the placed pageItem. To see the details use the links I posted in my last reply.
For examples search this forum for the named method and preference.
Regards,
Uwe
Copy link to clipboard
Copied
Hello Uwe,
I referred to an InDesign library.
Thanks for your help!
Regards, César