I am working on an XML based InDesign layout solution. The XML contains images which are imported as inline objects in a text frame. What I want to do is get every object (inline frames specifically) with a particular XML tag associated with it. Once I do that, I will be able to manipulate the object’s properties (I hope) such as dimensions, graphic fitting, fill, etc.
This is where I am at. Can’t quite get there yet.
tell application "Adobe InDesign CS4"
tell document 1
set XMLTags to id of every XML tag
set myTag to item 2 of XMLTags
set myElement to every text frame whose associated XML element is myTag
Does anyone have any suggestions?
I would have to double check the exact way to do it, and will see if I have time later. However, an inline graphic is a child of the story that it is part of. Given this you need to get every text frame of every story, and as I recall it would look something like this (not tested):
set myElement to every text frame of every story whose associated XML element is myTag
I agree. Having experienced a lot of InDesign scripting, you need to check within all stories of all pages, etc. There is no way to get such info with such a simple code, sorry! :rolleyes:
I would’ve thought that such simple code would be enough, but noooo, looks like you have to get very specific! In conclusion, check the child-parent relationships of your elements and go through them in the right order to find all your xml elements in your document.