Copy link to clipboard
Copied
Just like the description says. Is there a script that Will shrink the art board to a textbox, Picture box etc...
I already need something like this, to a non-specific document (without all the dangers Uwe pointed).
So, try it. I'll be glad if it works for you too.
...//DESCRIPTION: Resize the page to the selected object's size
//=============================================================
// Script by Luis Felipe Corullón
// Contato: lf@corullon.com.br
// Site: http://lf.corullon.com.br
//=============================================================
var myScriptName = "Resize page to selected object size"
if (app.
Copy link to clipboard
Copied
You mean resize the page to selected object's size?
Em 8 de jan de 2018 18:39, "cbishop01" <forums_noreply@adobe.com> escreveu:
Adobe Community <https://forums.adobe.com/?et=watches.email.thread>
Is there a script to shirnk the Artboard to a selected Textbox?
criado por cbishop01
<https://forums.adobe.com/people/cbishop01?et=watches.email.thread> em
*InDesign
Scripting* - Visualize a discussão completa
<https://forums.adobe.com/message/10088851?et=watches.email.thread#10088851>
Copy link to clipboard
Copied
Hi,
not exactly what you want, but a good start to begin with:
EDITED: Unfortunately the linked post was not transferred from the old Adobe InDesign Scripting Forum to this new forum last year. I leave it there; maybe someone can detect its contents somewhere else?!
But be forewarned* :
Marc Autret on Reframing Pages: a Dangerous Sport
Indiscripts :: InDesign Scripting Forum Roundup #10
Link to the forum thread where Marc answered:
EDITED: Unfortunately the linked post was not transferred from the old Adobe InDesign Scripting Forum to this new forum last year. I leave it there; maybe someone can detect its contents somewhere else?!
apply master page after page size change
*Peter Kahrel is using method resize() instead of reframe(), but I think, that's the same dangerous sport if it comes to documents with facing pages documents and applied masters. Also consider elements that will wrap text, that should not move relative to the selected text frame. Or: text that is forced to the document's baseline grid. Especially inspect baselineGridRelativeOption or baselineStart that should be changed as well so that with a changing page size the grid will not move relative to the selected text frame.
Regards,
Uwe
Copy link to clipboard
Copied
I already need something like this, to a non-specific document (without all the dangers Uwe pointed).
So, try it. I'll be glad if it works for you too.
//DESCRIPTION: Resize the page to the selected object's size
//=============================================================
// Script by Luis Felipe Corullón
// Contato: lf@corullon.com.br
// Site: http://lf.corullon.com.br
//=============================================================
var myScriptName = "Resize page to selected object size"
if (app.version < 6) {
myFunction();
}
else {
app.doScript(myFunction, ScriptLanguage.javascript, undefined, UndoModes.fastEntireScript, myScriptName);
}
function myFunction() {
if (!app.documents.length || (app.documents.length && !app.documents[0].visible)) {
alert("There is no opened document(s).","Script by LFCorullón");
}
else {
app.activeDocument.viewPreferences.horizontalMeasurementUnits = app.activeDocument.viewPreferences.verticalMeasurementUnits = MeasurementUnits.points;
if (app.selection.length == 1) {
var mySel = app.selection[0];
var myW = mySel.geometricBounds[3] - mySel.geometricBounds[1];
var myH = mySel.geometricBounds[2] - mySel.geometricBounds[0];
var myPage = app.activeWindow.activePage;
var myTop = app.activeWindow.activePage.marginPreferences.top;
var myBottom = app.activeWindow.activePage.marginPreferences.bottom;
var myLeft = app.activeWindow.activePage.marginPreferences.left;
var myRight = app.activeWindow.activePage.marginPreferences.right;
var margins = confirm("Do you want to keep the document margins?");
if (margins == true) {
myPage.resize(CoordinateSpaces.INNER_COORDINATES, AnchorPoint.CENTER_ANCHOR, ResizeMethods.REPLACING_CURRENT_DIMENSIONS_WITH, [myW+56.692, myH+56.692]);
app.activeWindow.activePage.marginPreferences.top = myTop;
app.activeWindow.activePage.marginPreferences.bottom = myBottom;
app.activeWindow.activePage.marginPreferences.left = myLeft;
app.activeWindow.activePage.marginPreferences.right = myRight;
}
else {
myPage.resize(CoordinateSpaces.INNER_COORDINATES, AnchorPoint.CENTER_ANCHOR, ResizeMethods.REPLACING_CURRENT_DIMENSIONS_WITH, [myW, myH]);
app.activeWindow.activePage.marginPreferences.top = 0;
app.activeWindow.activePage.marginPreferences.bottom = 0;
app.activeWindow.activePage.marginPreferences.left = 0;
app.activeWindow.activePage.marginPreferences.right = 0;
}
app.activeDocument.viewPreferences.horizontalMeasurementUnits = app.activeDocument.viewPreferences.verticalMeasurementUnits = MeasurementUnits.millimeters;
app.activeDocument.align(mySel, AlignOptions.HORIZONTAL_CENTERS, AlignDistributeBounds.PAGE_BOUNDS);
app.activeDocument.align(mySel, AlignOptions.VERTICAL_CENTERS, AlignDistributeBounds.PAGE_BOUNDS);
}
}
}
Copy link to clipboard
Copied
This is darn close i just need to Height to change the Width is a constant. I'll play around and see if i can make it work the way i need.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now