[GastForen Programme Print/Bildbearbeitung Adobe InDesign Skriptwerkstatt

  • Suche
  • Hilfe
  • Lesezeichen
  • Benutzerliste

Per Skript auf alle Notizen zugreifen

Gerald Singelmann
  
Beiträge gesamt: 6269

13. Okt 2011, 11:06
Bewertung:

gelesen: 4767

Beitrag als Lesezeichen
Zitat was ist mit table.notes, bzw. story.tables[index].notes


gips nich.

Ich bin meistens zu der Einstellung übergegangen: "Wenn ich keine Zeit zum Nachschlagen habe, sollte ich auch nicht antworten."

Notizen können auch in einer Tabelle in einer Tabelle in einer Tabelle sein. Es braucht also eine Rekursion. Für die, die das noch nie gemacht haben:
Code
//*********************************************************************** 
//
// get all notes of document
//Description:Sammelt alle Notizen auch aus verschachtelten Tabellen in ein Array
//
// [Ver: 0.1] [Author: Gerald Singelmann] [Modif: 11-10-13]
// [Lang: DE] [Req: InDesign CS5] [Creat: 11-10-13]
//
// Bugs & Feedback : gerald{at}cuppascript{dot}com
// www.cuppascript.com
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
//*********************************************************************

#target indesign

get_notes();

function get_notes() {
var all_notes = new Array();
var doc = app.activeDocument;
var stories = doc.stories.everyItem().getElements();
for (var n = 0; n < stories.length; n++) {
get_notes_of_x( stories[n] );
}
alert (all_notes.length );

function get_notes_of_x( x ) {
if (x.constructor.name == "Story") {
for (var n = 0; n < x.notes.length; n++) {
all_notes.push( x.notes[n] );
}
for (var n = 0; n < x.tables.length; n++) {
get_notes_of_x( x.tables[n] );
}
}
if (x.constructor.name == "Table") {
for (var n = 0; n < x.cells.length; n++) {
get_notes_of_x( x.cells[n] );
}
}
if (x.constructor.name == "Cell") {
for (var n = 0; n < x.notes.length; n++) {
all_notes.push( x.notes[n] );
}
for (var n = 0; n < x.tables.length; n++) {
get_notes_of_x( x.tables[n] );
}
}
}
return all_notes;
}


(Dieser Beitrag wurde von Gerald Singelmann am 13. Okt 2011, 11:07 geändert)
Änderungsverlauf:
Beitrag geändert von Gerald Singelmann (Veteran) am 13. Okt 2011, 11:07