/* spaceBefore adds space before paragraphs with the scaling hack! Version: 1.0 License: CC Last-Change: 18.04.2009 Gregor Fellenz http://www.indesignblog.com/ */ // Ab CS4 Skript Undo-Fähigkeit herstellen try { if (app.version.substring(0,1) == "6") { var undoName = "SpaceBefore.jsx"; app.doScript(main, undefined , undefined,UndoModes.fastEntireScript , undoName ); } else { if (app.version.substring(0,1) == "5") { main(); } else { alert ("Es wird mindestens InDesign CS3 benötigt ...") } } } catch (e) { alert("Es ist ein Fehler aufgetreten!\n" + e + "\nZeile: " + e.line + "\nSkript: " + e.fileName ); } function main () { const myOldXUnits = app.activeDocument.viewPreferences.horizontalMeasurementUnits; const myOldYUnits = app.activeDocument.viewPreferences.verticalMeasurementUnits; const myOldInteraction = app.scriptPreferences.userInteractionLevel; app.activeDocument.viewPreferences.horizontalMeasurementUnits = MeasurementUnits.points; app.activeDocument.viewPreferences.verticalMeasurementUnits = MeasurementUnits.points; app.scriptPreferences.userInteractionLevel = UserInteractionLevels.INTERACT_WITH_ALL; if (app.selection[0].constructor.name == "InsertionPoint") { var myDialog = app.dialogs.add({name:"Abstand vor in mm",canCancel:true}); var myPointSizeField = myDialog.dialogColumns.add().realEditboxes.add({editValue:5}); //Display the dialog box. var abstandVor; var myResult = myDialog.show(); if(myResult == true){ abstandVor = myPointSizeField.editValue; myDialog.destroy(); } else{ //User clicked Cancel, so remove the dialog box from memory. myDialog.destroy(); } var par = app.selection[0].paragraphs[0]; //1mm == 2.834645669pt //par.spaceBefore = abstandVor + "mm"; abstandVor = (abstandVor + (abstandVor/2.265)) * 2.834645669; var origGroesse = par.pointSize; par.pointSize = origGroesse + abstandVor // Scale berechnen var scale = (origGroesse / (origGroesse +abstandVor )) * 100; par.verticalScale = scale; par.horizontalScale = scale; } else { alert("Bitte Einfügemarke in den Absatz setzen!"); } app.activeDocument.viewPreferences.horizontalMeasurementUnits = myOldXUnits; app.activeDocument.viewPreferences.verticalMeasurementUnits = myOldYUnits; app.scriptPreferences.userInteractionLevel = myOldInteraction; }