mediengestalter.info
FAQ :: Mitgliederliste :: MGi Team

Willkommen auf dem Portal für Mediengestalter

Aktuelles Datum und Uhrzeit: Di 23.04.2024 09:00 Benutzername: Passwort: Auto-Login

Thema: InDesign FontBook Script anpassen vom 04.06.2012

Neues Thema eröffnen   Neue Antwort erstellen MGi Foren-Übersicht -> Programmierung -> InDesign FontBook Script anpassen
Autor Nachricht
noisekick91
Threadersteller

Dabei seit: 02.05.2012
Ort: -
Alter: 32
Geschlecht: Männlich
Verfasst Mo 04.06.2012 07:26
Titel

InDesign FontBook Script anpassen

Antworten mit Zitat Zum Seitenanfang

Hey leute Lächel

Ich sitz grade an der Erstellung einens Font Book Scripts für InDesign. Meine Kenntnisse in Java sind unterirdisch, daher hier der Post.

Das Script soll veranlassen, dass alle gewählten Schriften auf ein A4 Dokument hoch, innerhalb des Textrahmens angeordnet werden. Das Format, die Schriftgröße, den Text und die Position des Rahmens hab ich schon angepasst.
Was noch fehlt ist:
-Mehrere Schriften (Arrays?) auf ein Dokument stellen.
-Den Namen der Schrift nicht in der Schrift selbst darstellen sondern immer in Arial oä, also einer neutralen Schrift.

Kann man die Zeile mit dem Schriftnamen denn nicht irgendwie abändern, also einen Parameter wie zB font-family:Arial oder sowas ?

Code:
//Font sizes to be displayed
myPointSize = [16];
var myBounds = [ „12mm“, „12mm“, „287mm“, „200mm“ ]; //Textbox size --fits 8.5x11 page size in landscape mode
// Text to be displayed
var myText = „ABCDEFGHIJKLMNOPQRSTUVWXYZß&“ + „\n“ + „abcdefghijklmnopqrstuvwxyz1234567890“ ;
//List of fonts you want to exclude
var myExcludeFonts = new Array;
myExcludeFonts = [ ];

//Select font (or all fonts)
var myFontList = new Array;
myFontList.push(„All fonts“);
for(var myCounter2 = 0; myCounter2 < app.fonts.length; myCounter2 ++){
myFontList.push(app.fonts[myCounter2].name);
}
var myFontDialog = app.dialogs.add({name:“Select Font...“});
with(myFontDialog){
with(dialogColumns.add()){
with(dialogRows.add()){
staticTexts.add({staticLabel:““});
var myFontDropdown = dropdowns.add({stringList:myFontList, selectedIndex:0});
}
}
}
var myFontResult = myFontDialog.show();
if(myFontResult == true) {
var myFontSelection = myFontList[myFontDropdown.selectedIndex];
myFontDialog.destroy();
//Create font book using all or selected font
if(myFontSelection == „All fonts“) {
var myFonts = new Array;
myFonts = app.fonts;
}
else {
var myFonts = new Array;
myFonts[0] = app.fonts.item(myFontSelection);
}
//Create a new document
var myDocument = app.documents.add();
myDocument.documentPreferences.facingPages = false;
myDocument.documentPreferences.pageOrientation = PageOrientation.portrait;

//Loop over all or selected font(s)
var myPageCounter = 0; //Initialize page counter
for (myCounter = 0; myCounter < myFonts.length; myCounter++) {
//If user didn‘t select a specific font check exclusion list
var exclFlag = 0; //Initialize
if (myFonts.length > 1) {
myFontName = myFonts[myCounter].name.toUpperCase();
for (myCounter3 = 0; myCounter3 < myExcludeFonts.length; myCounter3++) {
myExcludeFontName = myExcludeFonts[myCounter3].toUpperCase();
if (myFontName.replace(/\s/g, „“) == myExcludeFontName.replace(/\s/g, „“)) {
exclFlag = 1;
break;
}
}
}
//If font is not on exclusion list
if (exclFlag == 0) {
//If it‘s the first page/font don‘t add a new page
if (myCounter > 0) {
myDocument.pages.add();
myPageCounter++;
}
//Set the document‘s ruler origin to page origin
myDocument.viewPreferences.rulerOrigin = RulerOrigin.pageOrigin;

//Create a new text frame
var myTextFrame = myDocument.pages.item(myPageCounter).textFrames.add();
//Specify the size and shape of the text frame
myTextFrame.geometricBounds = myBounds;
//Create text contents with font name and text
//Text containing font sizes
myFontSizeText = myPointSize[16] ;
var myTextContents = myFonts[myCounter].name + myFontSizeText ;

//Place text contents into text frame
myTextFrame.contents = myFonts[myCounter].name + „\n“ + myText;

//Format each paragraph
for (myCounter2 = 0; myCounter2 < myPointSize.length; myCounter2++) {
myTextFrame.parentStory.paragraphs.item(myCounter2).appliedFont = myFonts[myCounter];
myTextFrame.parentStory.paragraphs.item(myCounter2).pointSize = myPointSize[myCounter2];
}
}
}
}
else {
myFontDialog.destroy();
}


mfG und Danke im Vorraus.
*Thumbs up!*
  View user's profile Private Nachricht senden
Ähnliche Themen wer kann mir mein script anpassen - Illustartor?
Polaroid Flash - Galerie Script - Größe anpassen
InDesign - Optionsfeld anpassen
InDesign CS4 Hilfslinien ans Grundlinienraster anpassen
Adobe InDesign - Text an Muster anpassen
Größe der Textrahmen in Indesign auf einmal anpassen
Neues Thema eröffnen   Neue Antwort erstellen
MGi Foren-Übersicht -> Programmierung


Du kannst keine Beiträge in dieses Forum schreiben.
Du kannst auf Beiträge in diesem Forum nicht antworten.
Du kannst an Umfragen in diesem Forum nicht mitmachen.