global projektliste tell application "Finder" set InDesignOk to false --Ist überhaupt eine Seite geöffnet? tell application "Adobe InDesign CS6" if front document exists then set InDesignOk to true else set InDesignOk to false display dialog "Bitte öffnen Sie eine enstprechende Musterseite" buttons {"Ende"} end if end tell if InDesignOk then set projektliste to {"Verlag", "Projekt 02", "Projekt 03", "Projekt 04", "Projekt 05"} set projekt to {"Verlag"} if projekt = {item 1 of projektliste as string} then --**************************************************** --******* P R O J E K T 0 1 ****************************** --**************************************************** set tododatei to choose file with prompt "Wählen Sie eine Steuerdatei aus:" --Datei öffnen zum Lesen set datref to open for access (tododatei as string) --Die drei Zeilen Einlesen set dateiinhalt to read datref as «class utf8» --Wichtig! close access datref --Die gesamte Variable wird anhand des characters NewLine aufgespalten --in eine Liste, die einzelne Zeilen enthält set AppleScript's text item delimiters to {ASCII character (10)} set Zeilen to every text item of dateiinhalt as list --Prüfen ob letztes Element ein Leerzeiele ist, wenn ja: weg damit if item -1 of Zeilen = "" then set Zeilen to reverse of Zeilen set Zeilen to rest of Zeilen set Zeilen to reverse of Zeilen end if --display dialog (Zeilen) --Diese Liste "Zeilen" wird elementweise duchlaufen --und wir merken uns, in , wo das Schlüsselwort "Musterseite:" vorkommt set AppleScript's text item delimiters to {} set zeilenanzahl to count Zeilen -- set aktuelleZeile to 1 set treffer to {} repeat while (aktuelleZeile ≤ zeilenanzahl) --Suche Schlüsselword "Musterseite:" in der aktuellen Zeile if (item aktuelleZeile of Zeilen contains "Musterseite:") then set treffer to treffer & aktuelleZeile else --nix end if set aktuelleZeile to aktuelleZeile + 1 end repeat --anhand der trefferliste können wir nun die einzelnen Zeilen zu Seiten/Seitenelementen kombinieren set trefferanz to count treffer if trefferanz = 0 then --Sonderfall else set k to 1 repeat while k ≤ trefferanz --Diese Var wird InDesign übergeben, gefüllt set SeitenElemente to {} set ZeileStart to item k of treffer if k < trefferanz then set ZeileStop to (item (k + 1) of treffer) - 1 set SeitenElemente to items ZeileStart thru ZeileStop of Zeilen as list else set SeitenElemente to items ZeileStart thru -1 of Zeilen as list end if platziereINDD_01(SeitenElemente) of me set k to k + 1 end repeat tell application "Adobe InDesign CS6" tell front document delete page 1 end tell end tell end if display dialog ("Satzvorgang abgeschlossen!") buttons {"OK"} else if projekt = {item 2 of projektliste as string} then --**************************************************** --******* P R O J E K T 0 2 ****************************** --**************************************************** else if projekt = {item 3 of projektliste as string} then --**************************************************** --******* P R O J E K T 0 3 ****************************** --**************************************************** else if projekt = {item 4 of projektliste as string} then --**************************************************** --******* P R O J E K T 0 4 ****************************** --**************************************************** else if projekt = {item 5 of projektliste as string} then --**************************************************** --******* P R O J E K T 0 5 ****************************** --**************************************************** end if end if -- - InDesignOk - Musterseite geöffnet end tell on platziereINDD_01(SeitenElemente) --**************************************************** --******* P L A T Z I E R E 0 1 **************************** --**************************************************** tell application "Adobe InDesign CS6" activate set myDocument to active document --Doku ist also schon geladen tell myDocument --Das erste Element aufspalten anhand des @ set AppleScript's text item delimiters to {"@"} set Musterseite to first text item of (first item of SeitenElemente) set SeitenZahl to second text item of (first item of SeitenElemente) --Aus Musterseite muß noch das "Musterseite:" entfernt werden set AppleScript's text item delimiters to {} set Musterseite to text items 13 thru item -1 of Musterseite --Das erste Element dieser Liste kann nun entfernt werden set SeitenElemente to rest of SeitenElemente set myMaster to master spread ((Musterseite) as string) of myDocument set seiteaktuell to make page at end with properties {applied master:myMaster} tell seiteaktuell set theIndex to index of seiteaktuell override page items of page theIndex of applied master of seiteaktuell destination page seiteaktuell --Als erstes die Seitenzahl try tell text frame "Seitenzahl" tell parent story set contents to SeitenZahl end tell end tell end try --nun den Rest set anzahl to count SeitenElemente set Elementindex to 1 if (((anzahl mod 2) = 0) and (anzahl ≥ 2)) then repeat with k from 1 to anzahl by 2 if Elementindex < 10 then set bildboxname to "B0" & Elementindex as string set textboxname to "T0" & Elementindex as string else set bildboxname to "B" & Elementindex as string set textboxname to "T" & Elementindex as string end if set bildboxpfad to item k of SeitenElemente --Die Farbe berücksichtigen set textboxinhalt to item (k + 1) of SeitenElemente set AppleScript's text item delimiters to {"@"} set farbe to first text item of textboxinhalt set textboxinhalt to second text item of textboxinhalt set AppleScript's text item delimiters to {} --try --tell rectangle bildboxname place (bildboxpfad) as alias --end tell --end try --tell text frame textboxname -- tell parent story -- set contents to textboxinhalt -- try -- set fill color of every paragraph to farbe -- end try -- end tell --end tell set Elementindex to Elementindex + 1 end repeat else --Anzahl der SeitenElemente ist nicht gerade oder 0 --display dialog anzahl end if end tell end tell end tell end platziereINDD_01