Copy link to clipboard
Copied
Bonjour,
Je cherche à redimensionné un bloc (textFrame).
je place son accroche sur:
app.activeWindow.transformReferencePoint = AnchorPoint.CENTER_ANCHOR;
Est-il possible de pas passer par "geometricBounds
", juste modifié la Hauteur et la Largeur.
Merci
Same question i asked yesterday.. use that script..
var myheight="30 pt"
var mywidth="25 pt"
var sel = app.selection[0];
var nw = new UnitValue ( mywidth, "pt" ).as("pt");
var nh=new UnitValue ( myheight, "pt" ).as("pt");
sel.resize
(
CoordinateSpaces.INNER_COORDINATES,
AnchorPoint.TOP_LEFT_ANCHOR,
ResizeMethods.REPLACING_CURRENT_DIMENSIONS_WITH,
[nw, nh]
);
Copy link to clipboard
Copied
Same question i asked yesterday.. use that script..
var myheight="30 pt"
var mywidth="25 pt"
var sel = app.selection[0];
var nw = new UnitValue ( mywidth, "pt" ).as("pt");
var nh=new UnitValue ( myheight, "pt" ).as("pt");
sel.resize
(
CoordinateSpaces.INNER_COORDINATES,
AnchorPoint.TOP_LEFT_ANCHOR,
ResizeMethods.REPLACING_CURRENT_DIMENSIONS_WITH,
[nw, nh]
);
Copy link to clipboard
Copied
Also if you need to give the values by prompt use like the following thread answers
Copy link to clipboard
Copied
Merci tpk1982,
Voici mon script fini ! merci à tous les participent avec vos morceau de code Glané par-ci par-là.
#target "indesign-11.064"
// --------------------------------------------------------------------------
// Script Rotation de pages Avec c'est Blocs
// Philippe Ruelle
// Version Beta 003
// 3 août 2016
// --------------------------------------------------------------------------
var o = {};
// 1 Selection le bloc ou les blocs
// 2 recuperation de la pages
// 3 Rotation de la page
// 4 Rotation des Bloc
main();
function main() {
// functionnel modification pour miseà jour du bloc des legendes
if(app.documents.length != 0){
if(app.selection.length != 0) {
if (app.selection[0].constructor.name == 'InsertionPoint'){
o.leDocument = app.activeDocument;
initialisePage(app.selection[0]);
laProcedure();
} else if(app.selection[0].constructor.name == 'TextFrame'){
//$.writeln('TextFrame');
o.leDocument = app.activeDocument;
initialisePageB (app.selection[0]);
rotationBloc ();
}
} else {
alert("Mettre son curseur à l'emplasement du sommaire.");
}
} else{
alert("Ouvrir vos documents.");
}
}//
//
//
function laProcedure() {
// si la page est erotation ou pas
if (getSpreadRotation(o.laPage) != 0) {
annulationRotation ();
}else {
//$.writeln("Rotation" );
rotationPage();
// effectu une rotation de -90
}
}
//
function initialisePageB (lObj) {
//$.writeln('initialisePageB');
var laSelection = lObj;
//$.writeln (lObj.constructor.name)
o.leBloc = laSelection;
o.laPage = laSelection.parentPage; // recuperaire la page parent du textFrame
o.laPageOffset = o.laPage.documentOffset;
//$.writeln (o.laPage.name + ' — ' + );
} //
// Faire fenetre avec choix de la rotation ou annulation de la rotation
function initialisePage(lObj) {
var laSelection = lObj;
if (laSelection.hasOwnProperty("baseline")) {
laSelection = laSelection.parentTextFrames[0]; // recuperaire le textFrames parent
o.leBloc = laSelection;
o.laPage = laSelection.parentPage; // recuperaire la page parent du textFrame
o.laPageOffset = o.laPage.documentOffset;
//$.writeln (o.laPage.name + ' — ' + );
}// fin du if
} //
function getSpreadRotation(/*Page|Spread|MasterSpread*/ps) {
// ---------------------------------------------------------
return ps.transformValuesOf(CoordinateSpaces.pasteboardCoordinates)[0].counterclockwiseRotationAngle;
}
// Annulation de la rotation
function annulationRotation () {
var infoTmpAccroche = app.activeWindow.transformReferencePoint; //OK
app.menuActions.itemByID(6183).invoke();//clear rotation
app.activeWindow.transformReferencePoint = AnchorPoint.CENTER_ANCHOR;
o.leBloc.rotationAngle = 0;
Resize (o.leBloc);
app.activeWindow.transformReferencePoint = infoTmpAccroche;
}
//
function rotationPage () {
var infoTmpAccroche = app.activeWindow.transformReferencePoint; //OK
app.menuActions.itemByID(6186).invoke();//-90 degree rotation
//app.menuActions.itemByID(6187).invoke();//90 degree rotation
//app.menuActions.itemByID(6183).invoke();//clear rotation
//$.writeln( app.activeWindow.transformReferencePoint);
app.activeWindow.transformReferencePoint = AnchorPoint.CENTER_ANCHOR;
o.leBloc.rotationAngle = 0;
Resize ( o.leBloc);
app.activeWindow.transformReferencePoint = infoTmpAccroche;
}//
function rotationBloc () {
// rotation page et rotation du bloc
// recuperation de l'accro /: OK
var infoTmpAccroche = app.activeWindow.transformReferencePoint; //OK
// $.writeln (o.leBloc.constructor.name);
app.activeWindow.transformReferencePoint = AnchorPoint.CENTER_ANCHOR;
o.leBloc.rotationAngle = 0;
Resize ( o.leBloc);
app.activeWindow.transformReferencePoint = infoTmpAccroche;
}//
//
function Resize (myRectangle) {
var dimentionRectengle = WidthAndHeight(myRectangle);
var myheight=dimentionRectengle[0];
var mywidth=dimentionRectengle[1];
//$.writeln("myheight : "+myheight +" — mywidth : " + mywidth)
var nw = new UnitValue ( mywidth, "mm" ).as("pt");
var nh = new UnitValue ( myheight, "mm" ).as("pt");
myRectangle.resize(CoordinateSpaces.INNER_COORDINATES,AnchorPoint.CENTER_ANCHOR,ResizeMethods.REPLACING_CURRENT_DIMENSIONS_WITH,[nw, nh]);
}//
//
function WidthAndHeight(myRectangle)
{
var gb = myRectangle.geometricBounds;
var myWidth = gb[3]-gb[1];
var myHeight = gb[2]-gb[0];
return [myWidth,myHeight];
}
Copy link to clipboard
Copied
..how would I get the below script (obtained from piggy-backing off of the script here) to be applied to multiple frames that are selected?
Currently even if many frame are selected it only affects the a single frame.
Thanks in advance everyone, to anyone that can help.
Cheers.
Copy link to clipboard
Copied
Try this:
var myheight="24.242 pt"
var mywidth="24.242 pt"
var sel = app.selection;
var nw = new UnitValue ( mywidth, "in" ).as("in");
var nh = new UnitValue ( myheight, "in" ).as("in");
for (var i=sel.length-1; i>=0; i--) {
sel.resize
(
CoordinateSpaces.INNER_COORDINATES,
AnchorPoint.TOP_LEFT_ANCHOR,
ResizeMethods.REPLACING_CURRENT_DIMENSIONS_WITH,
[nw, nh]
);
}
Copy link to clipboard
Copied
.....amazing, thanks so much.
Yeah I know it had to do with that sel.length deal — I’ve seen it in similar situations where you need to possibly apply to multiple selections, etc.
One day I’ll more of a handle on all this.
Thanks again...really appreciate it.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now