Split textframe based on
I'm working on a script that should seperates a textframe based on it's paragraphstyle.
Example:
A textframe has a formatted newspaper article.
This textframe should be split and shaped into an intro, a title, a leading, etc...
I'm able to seperate the textframe based on size, but often this is not sufficient.
Sometimes there is no intro or a leading, so it would be handy if the script could find out what the paragraph style is, so I could redefine how the textframe should be shaped.
// Get the selected textFrame
var doc = app.activeDocument;
var sel = app.selection[0];
if(sel.hasOwnProperty('baseline')) {
var tf = sel.parentTextFrames[0];
} else if (sel instanceof TextFrame) {
var tf = sel;
}
// Change the dimensions of the textFrame for Intro
sel.geometricBounds = [
y1,
x1,
y1+heightIntro,
x1+widthIntro
];
// Create new textframe for Title and link it to the Intro textframe
var tf2 = doc.pages[0].textFrames.add();
tf2.previousTextFrame = tf;
tf2.properties = {
geometricBounds: [
y1+boxIntro,
x1,
y1+boxIntro+boxTitle,
x1+tfWidth
]
};
...... 
Is such a thing possible? Knowing I'll have to manipulate each textframe accordingly.
Thanks ahead!
