Pages

Wednesday, August 29, 2018

Get MediaSpan Jazbox Text Elements

Get MediaSpan Jazbox Text Elements


Part of Something Bigger

If you are a MediaSpan Jazbox site there are many useful things that you can do with ExtendScript (JavaScript) to interact with your stories and pages in Adobe InCopy and Adobe InDesign documents. But some things are more difficult than others. In the case of an Adobe InCopy story from Jazbox, locating the individual InCopy stories that make up the individual Jazbox Text elements is tricky. Many things affect the ordering of those elements and you simply cannot count of app.documents[0].stories[1] being something like the head element all the time. It wont be. And once a story has hit the Adobe InDesign page the number of stories in the Adobe InCopy file can balloon. You could find that your head is suddenly stories[17].

But there is hope. There is a storyTitle property in every story. But this is another one of those weird cases where a Story to a user isnt the same as a story to ExtendScript. Every Jazbox Text Element used in an InCopy story will have a storyTitle that matches the name of the Text Element in the database. Stories that are not part of the open document wont display their storyTitle property, because they are a different Story placed on the page. Thus there is a method to find all the Text Elements -- find all the stories with a storyTitle property.

The function below is documented to the point of showing exactly how to access any Text Element that exists in a document. You can do anything you want to them, once you know how to find them. It is another case of generating a good reference (like all the postings about generating good document references). Keep in mind that in order to allow both forms of access with the associative array that the Text Element names will be edited to not include any spaces and no other odd characters. All storyTitles are run though this code:

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.