I haven’t the time, to investigate here further, sorry. As a script beginner, it needs much more time for me, than a pro would need for that. So maybe others could dive in here or you must investigate in a paid-script. What I have so far: 1. To get the position of the frames, I would anchor them at the first position of the current found (and maybe release them later) 2. To have more control of the position, the next version of the script assumes a objectStyle "Marginalien" with custom anchored settings 3. There a two ways to bring your table in the anchored frame: a) Create your table first and move the table to the new textFrame >> Did not know how to do that, since I had serveral problems with the index b) Create the textframe first, move the found to the new frame and convert then to table >> In this case I’m wondering why I get no index issues, but it worked // das aktuelle Dokument var curDoc = app.activeDocument; // die aktuelle Auswahl var curSel = app.selection[0]; // die Sucheinstellungen zurücksetzen app.findGrepPreferences = app.changeGrepPreferences = null; // die Sucheinstellungen setzen app.findGrepPreferences.findWhat = "(\\|.+\\r)+\\|.+"; var result = curSel.findGrep( true ); // eine Schleife durch die Fundstellen for ( var f = 0; f < result.length; f++ ) { // die letzte Fundstelle var curResult = result ; var iP = curResult.insertionPoints[0]; var newTf = iP.textFrames.add({geometricBounds: [ 0, 0, "30mm", "80mm"]}); newTf.appliedObjectStyle = curDoc.objectStyles.itemByName("Marginalien"); var newContent = curResult.move(LocationOptions.AFTER, newTf.insertionPoints[0]); // Fundstelle in Tabelle konvertieren var curTable = newContent.convertToTable("|"); // Erste und letzte Spalte löschen curTable.columns[0].remove(); curTable.columns[-1].remove(); // Tabelle wieder an Textrahmen anpassen var tFrame = curTable.parent; var fWidth = tFrame.geometricBounds[3] - tFrame.geometricBounds[1]; curTable.width = fWidth; // Erste Zeile in Kopfzeile wandeln curTable.rows[0].rowType = RowTypes.headerRow; // Tabellenformat zuweisen curTable.appliedTableStyle = "Redtable"; // vorsichtshalber Abweichungen vom Tabellenformat löschen curTable.clearTableStyleOverrides( true ); // den Whitespace säubern app.findGrepPreferences = null; app.findGrepPreferences.findWhat = "_\\.\\s|\\s+$|^\\s+"; app.changeGrepPreferences.changeTo = ""; curTable.changeGrep(); } app.findGrepPreferences = null; For own interest: It would be great, if someone could show me on a simple example, how I can add a frame before a given table and move the table (or the paragraph that holds the table) to that frame. At the moment I get a warning here, something like: You cannot move the content to the same position. Thanks kai
... View more