Script to distribute the object for the page, margin, or the spread?

I see I can create shortcuts to align objects to the page, margin, and the spread, but I can't specify to what I want to distribute an item! I went through the list in the Shortcuts dialog keyboard again and again, I don't couldn't find it! Why is this omitted? Is this an oversight?

And my main question: how is this possible? There the script to achieve this goal?

Thanks in advance!

Well, in general is not a good idea for the scripts modify the user's selection. Unless the purpose of the script is that the user sees that other things are selected.

You can get an array of all the objects on the current dotted with app.activeWindow.activeSpread.allPageItems but that will include the internal elements of groups. If you want the elements of higher level (including groups), use () .getElements () app.activeWindow.activeSpread.pageItems.everyItem.

So to do what you asked, you can select all with:

app.select(app.activeWindow.activeSpread.pageItems.everyItem().getElements());

But if your goal is to distribute to each of them, use:

app.activeDocument.distribute(
  app.activeWindow.activeSpread.pageItems.everyItem().getElements(),
  DistributeOptions.HORIZONTAL_CENTERS,
  AlignDistributeBounds.SPREAD_BOUNDS);

Tags: InDesign

Similar Questions

  • Object extends outside page margins

    Overview of object (in story editor) exceeds the margins of the page, without worrying about size defined for the object itself. I encounter this problem on one of my sites of Muse. This is a recent problem and it doesn't allow me to place a new banner, social plugin or another HTML element on the site, otherwise I exceed the margin of the page. Someone known and corrected it? In the affirmative, please let me know. Thank you! :-)

    Hi, Othar, page width is 960 and the width of the margins is 20.

    Social plugin is way too small, but it certainly seems that the width of the object follows the width of the page (960).

    No way to resize the object, unfortunately.

    There must be a mistake, but I am not able to identify it.

    While checking the old Muse of the same site files, I found one on June 2, 2015, which does not exhibit the problem.

    Then I'll probably save it under a new name, the update and transfer instead of the current... hoping that the problem will come back to the top.

  • Export the spreads for printing French fold

    Hello, I have a book in InDesign I want to print french fold. I put it in place in a traditional way, as follows:

    Scan4.jpeg

    But I would like to be able to export as spreads. as follows:

    Scan4 2.jpeg

    (Rather than the traditional pasta spread that would be page 1 by itself, then pages 2 and 3 together.)

    I know if my paper was that of 6 pages, simply unlock all master items and move all pages second to do the plan would work, but my book is about 250 pages, not 6).

    Does anyone know of a simple way to do this? Or a script that reorganizes the "spreads" for you? Or a plugin for this?

    Thank you!

    Create a new document and use the file > options show and the Place to import all the pages - then place the pages where you want.

  • measure the actual page for each page size in the listbox

    Hi guys,.

    I'm trying to write a script that lists all the pages in the ListBox with 2 additional columns: width and height

    and stuck when trying to get the limits of pages for each page in the document.

    My result looks like this now:

    pagedimensions.jpg

    script no matter what I'm trying to get only the size of the 1st page and fill in all items.

    My code to get the size of the page above is:

    myDoc = app.activeDocument;

    page var = myDoc.pages [0];

    ...

    function myRealHeight() {}

    var Pbound = page.bounds;

    var pH = Pbound [2] - Pbound [0];

    var realHeight = [];

    for (j = 0; j < myDoc.pages.length; j ++) {}

    realHeight.push (pH);

    }

    Return realHeight;

    }

    I have tryied a few different ways but but always returned [object Page] or higher.

    I'm newbie in scripts, and if someone could help me will be great.

    Thank you

    (let me know if other parts of the code are required)

    Try this (sorry not tested).

    var myDoc = app.activeDocument;

    ...

    function myRealHeight() {}

    var realHeight = [];

    for (j = 0; j< mydoc.pages.length;="" j="">

    page var = myDoc.pages [j];

    var Pbound = page.bounds;

    var pH = Pbound [2] - Pbound [0];

    realHeight.push (pH);

    }

    Return realHeight;

    }

  • Script to make an object the size of the artboard.

    I'm looking for help to try to be a subject of the exact size of the artboard.  It's something I do on a daily basis for many different reasons, and it would be very useful if this can happen automatically for any size would be the artboard.  If I understand the only way is a script but I have no experience with no shooting scripts illustrator, im certainly no programmer.  I put in place in the past to copy since the entries on the artboard when you are on the work plan tool, but these rounds to la.01 the closest quickkeys and is not sufficiently precise so that I work with.  Also, if I do this with several pages open illustrator is very slow to respond to the work plan tool.  If anyone has any idea where to start or saw these other scripts I'd be very happy.  Thank you.

    Here is a script that I've seen here that I believe can contain what I need but now knowing I have no idea where to start on changing the programming.  All I need is the part where an object is placed on the artboard that is the same size as the artboard.  If someone can advise on editing I apprecaite it.

    #target illustrator

    function main() {
         if (app.documents.length == 0) {
              alert('Open a document before running this script');
              return; // Stop script here no doc open…
         } else {
              var docRef = app.activeDocument;
              with (docRef) {
                   if (selection.length == 0) {
                        alert('No items are selected…');
                        return; // Stop script here with no selection…
                   }
                   if (selection.length > 1) {
                        alert('Too many items are selected…');
                        return; // Stop script here with selection Array…
                   } else {                   
                        var selVB = selection[0].visibleBounds;
                        var rectTop = selVB[1] + 36;
                        var rectLeft = selVB[0] - 36;
                        var rectWidth = (selVB[2] - selVB[0]) + 72;
                        var rectHeight = (selVB[1] - selVB[3]) + 72;              
                        selection[0].parent.name = 'CC';
                        selection[0].filled = false;
                        selection[0].stroked = true;
                        var ccColor = cmykColor(0, 100, 0, 0);              
                        var ccCol = spots.add()
                        ccCol.name = 'CC';
                        ccCol.color = ccColor;
                        ccCol.tint = 100;
                        ccCol.colorType = ColorModel.SPOT;
                        var cc = new SpotColor();
                        cc.spot = ccCol;                   
                        selection[0].strokeColor = cc;
                        selection[0].strokeWidth = 1;                   
                        var tcLayer = layers.add();
                        tcLayer.name = 'TC';
                        var padBox = pathItems.rectangle(rectTop, rectLeft, rectWidth, rectHeight, false);
                        padBox.stroked = false;
                        padBox.filled = true;
                        var tcColor = cmykColor(0, 100, 90, 0);         
                        var tcCol = spots.add()
                        tcCol.name = 'TC';
                        tcCol.color = tcColor;
                        tcCol.tint = 100;
                        tcCol.colorType = ColorModel.SPOT;
                        var tc = new SpotColor();
                        tc.spot = tcCol;
                        padBox.fillColor = tc;    
                        padBox.move(docRef, ElementPlacement.PLACEATEND);
                        artboards[0].artboardRect = (padBox.visibleBounds);
                        redraw();
                        rectWidth = (rectWidth-72)/72;
                        rectWidth = roundToDP(rectWidth,1);
                        rectHeight = (rectHeight-72)/72;
                        rectHeight = roundToDP(rectHeight,1);
                        var textString = rectWidth + ' x ' + rectHeight;
                        prompt('Copy Me', textString);
                   }         
              }
         }
    }

    main();

    function roundToDP(nbr, dP) {
         dpNbr = Math.round(nbr*Math.pow(10,dP))/Math.pow(10,dP);
         return dpNbr;
    }

    function cmykColor(c, m, y, k) {
         var newCMYK = new CMYKColor();
         newCMYK.cyan = c;
         newCMYK.magenta = m;
         newCMYK.yellow = y;
         newCMYK.black = k;
         return newCMYK;
    }

    Here you go, select an object before you run, if your art is more than an object, first make a group.

    #target Illustrator
    
    //  script.name = fitObjectToArtboardBounds.jsx;
    //  script.description = resizes selected object to fit exactly to Active Artboard Bounds;
    //  script.required = select ONE object before running; CS4 & CS5 Only.
    //  script.parent = carlos canto // 01/25/12;
    //  script.elegant = false;
    
    var idoc = app.activeDocument;
    selec = idoc.selection;
    if (selec.length==1)
              {
                        // get document bounds
                        var docw = idoc.width;
                        var doch = idoc.height;
                        var activeAB = idoc.artboards[idoc.artboards.getActiveArtboardIndex()]; // get active AB
    
                        docLeft = activeAB.artboardRect[0];
                        docTop = activeAB.artboardRect[1]; 
    
                        // get selection bounds
                        var sel = idoc.selection[0];
                        var selVB = sel.visibleBounds;
                        var selVw = selVB[2]-selVB[0];
                        var selVh = selVB[1]-selVB[3];
    
                        var selGB = sel.geometricBounds;
                        var selGw = selGB[2]-selGB[0];
                        var selGh = selGB[1]-selGB[3];
    
                        // get the difference between Visible & Geometric Bounds
                        var deltaX = selVw-selGw;
                        var deltaY = selVh-selGh;
    
                        sel.width = docw-deltaX; // width is Geometric width, so we need to make it smaller...to accomodate the visible portion.
                        sel.height = doch-deltaY;
                        sel.top = docTop; // Top is actually Visible top
                        sel.left = docLeft; // dito for Left
    
              }
    else
              {
                        alert("select ONE object before running");
              }
    
  • Where the SQL Scripts running after the installation of the ODAC for Oracle Client?

    I just installed ODAC for Oracle Client on a windows server that runs a database of sql server, allowing developers to connect to a web application to an Oracle/Unix database. The installation States to run SQL scripts, located in the $ORACLE_HOME\ASP.NET\SQL directory after installation. I don't know where to run them? On the ORACLE DB on the Unix server? If someone could let me know, I'd appreciate it. Thank you.

    You must run on the Oracle database server, but they are necessary only if you use Oracle for ASP.NET providers.

    If you just install the software, so you can use OLEDB with SQL Server linked server, for example, you don't need them. What do you need to run although if this is the case is the oramtsadmin.sql script that creates the objects used by the Oracle MTS Recovery Service (if you do not have these objects created on the database) that SQL Server uses a distributed transaction for Oracle connections I think.

    It will be useful,
    Greg

  • Is it possible to find the two sentences into one pdf file? For example, I know the words 'Here' and 'the answer' occur more than once in my document, but only once on the same page. I'm looking for this page.

    Is it possible to find the two sentences into one pdf file? For example, I know the words 'Here' and 'the answer' occur more than once in my document, but only once on the same page. I'm looking for this page.

    I tried to do this by using the search but it will find only them, if they occur as a long chain, that is to say "Here's the answer" rather than how they occur in the document it is to say "Here 's" a bunch of information that leads you to 'the answer'. The search feature so standard did not help.

    Then I tried to do this by using the tool to delete (obviously not the application of writing!) because it allows me to search for multiple words or phrases, however it is not highlight what page both are found. I tried to turn on the preference to enable deletions of comments and even if it meant that I could then go through all the comments, it's still not faster than my document is more than 1,000 pages, which meant there were too many total comments for me to be able to easily identify which page had both.

    Any ideas?

    There is no built-in way to search for two strings and limited to show only the results that appear on the same page.

    It can be done by using a custom script, however.

  • script to copy the color of the object below

    Hello

    I was wondering if there is a script to copy the fill color of an object below.

    I need to transfer the fill colors of 300 different places for 300 circles, how can I do this quickly?

    Thank you

    Pisistratus

    Update:

    #target illustrator
    function test(){
        function isSquare(item){
            if(item.pathPoints.length > 4){
                return false;
            }
            for(var i=0; i 0){
            var doc = app.activeDocument;
            for(var i=0; i= v[0] && v1[2] <= v[2] && v1[1] <= v[1] && v1[3] >= v[3]){
                                thisInnerPath.fillColor = thisPath.fillColor;
                            }
                        }
                    }
                }
            }
        }
    }
    test();
    
  • Script to collect the "Master page-text-content of the framework" details

    Hello

    The collection "Masterpage - TextFrame - content" Indesign file details.

    If the spread of the master page text frame, I need to retrieve this text frame content in separate folder. If it possible by Indesign script?

    Thank you

    hasvi

    Hi Hasvi,

    I hope this helps you!

    var doc = app.activeDocument;

    var master = doc.masterSpreads;

    var content = "";

    for (var i = 0; i)<>

    {

    for (var j = 0; j)<>

    {

    If (master [i] .parentPage .textFrames [j]! = null) {}

    content += [i] master .silence .textFrames [j] + "\t" + master [i] .name + "\r";

    }

    }

    }

    var file = new File ("c:/1. txt");

    leader. Open ("w");

    leader. Write (happy);

    leader. Close();

    Kind regards

    Cognet

  • Can someone edit this page duplication and the reissue of links script to manage the 2 presentations?

    Hello!

    After searching that I need long, I could get to this post: http://forums.adobe.com/message/5341001

    With the following script:

    Howard var = app.activeDocument;

    judgment of var = 2;

    var mPDF, oldPageNum, currPDF, currFile, organ;

    While (off > 1) {}

    stop = 1;

    mPage var = mDoc.pages [-1] .duplicate ();

    var mGraphics = mPage.allGraphics;

    for (var i = 0; i < mGraphics.length; i ++) {}

    mPDF =. parent.pdfs mGraphics [i] [0];

    If (mPDF.isValid & & mPDF.itemLink.status == LinkStatus.NORMAL) {}

    oldPageNum = mPDF.pdfAttributes.pageNumber;

    app.pdfPlacePreferences.pageNumber = oldPageNum + 1;

    currFile = mPDF.itemLink.filePath;

    Body = mPDF.parent;

    mRec.place (File (currFile));

    stop = mRec.pdfs [0].pdfAttributes.pageNumber;

    }

    }

    }

    mPage.remove ();

    However, what I really need, is this script to work with page layouts, two, one for the same pages and one for odd pages, because I would print these on a double page in duplex face and each provision must be different, so that they will align correctly. Sounds easy enough, but I'm not good at this complex javascript :/

    Can anyone modify this script to do this? Thank you!

    CS6 Windows7


    Hello

    Lets assume that starting over with a doc script with:

    -at least 3 pages, page-layout so both are present

    -pagesRegard is true, then the script could reproduce any spread.

    changes must be made:

    1 var mPage = mDoc.spreads [-1] .duplicate ();

    2 app.pdfPlacePreferences.pageNumber = oldPageNum + 2;

    Jarek

  • script to calculate the hypotenuse of a page and place an image block

    Hello

    I wonder if anyone can help me with a script.

    We need to get the size of an open document, calculate the hypotenuse (visible diagonal), it divides by 10 and place a picture box square on the page to this size in the upper left corner.

    I found this javascript to calculate the hypotenuse but don't know how to use it or integrate it.

    function hypotenuse (a, b) {}

    function square (x) {return x * x ;}

    Return Math.sqrt ((a) square + square (b));

    }

    function secondFunction() {}

    var result;

    result = hypotenuse (1,2);

    alert (result);

    }

    Yes, I am a total newbie and would appreciate anyones help.

    Thank you

    maxrus2012

    Hi maxrus,

    It seems so simple that anyone was necessary to answer you! Indeed, we can easily retrieve the height and width of a page, then calculate the diagonal, then create a square based on this length.

    In any case, let's try to do this routine work in any context, supporting all units of measure custom, parameters of leaders, spreads rotated and/or same scaling / biased pages! To do this, avoid common methods from "geometric limits." Interesting challenge!

    Here is my attempt:

    // Create a square based on the active page's diagonal length (10%)
    // ===========================
    
    function measureDiagonal(/*Page*/page)
    // -------------------------------------
    // Ret. the page's diagonal in pts (relative to the page CS)
    {
        var CS_INNER = CoordinateSpaces.innerCoordinates;
    
        var wh = page.resolve(AnchorPoint.bottomRightAnchor, CS_INNER)[0],
            w = wh[0],
            h = wh[1];
    
        return Math.sqrt(w*w + h*h); // Pythagorean theorem
    }
    
    function createTopLeftCornerRectangle(/*Page*/page, /*num[2]*/wh)
    // -------------------------------------
    // wh: width and height of the rectangle in pts (relative to the page CS)
    {
        // Some const shortcuts
        // ---
        var    CS_SPREAD = CoordinateSpaces.spreadCoordinates,
            CS_INNER = CoordinateSpaces.innerCoordinates,
            RM_REPLACE = ResizeMethods.replacingCurrentDimensionsWith,
            AP_TOP_LEFT = AnchorPoint.topLeftAnchor;
    
        var spread = page.parent,
            // Create a rectangle (in the spread CS--the page CS is not relevant yet)
            // ---
            rec = spread.rectangles.add({fillColor:'Black'}),
            // Page transformation values (relative to the spread)
            // ---
            pageMxValues = page.transformValuesOf(CS_SPREAD)[0].matrixValues;
    
        // Normalize the rectangle in the spread
        // (the size does not matter here)
        // ---
        rec.reframe(CS_SPREAD, [[0,0],[10,10]]);
    
        // Apply the page transfo to the rectangle
        // so that its inner space fits the page space
        // ---
        rec.transform(CS_SPREAD, [[0,0], CS_SPREAD], pageMxValues);
    
        // Finally, resize the rec
        // ---
        rec.resize(CS_INNER, AP_TOP_LEFT, RM_REPLACE, wh.concat(CS_INNER));
    
        return rec;
    }
    
    var    FACTOR = .1, // 10%
        win = app.layoutWindows.length && app.activeWindow,
        page = win && (win instanceof LayoutWindow) && win.activePage,
        size = page && page.isValid && FACTOR*measureDiagonal(page);
    
    size && createTopLeftCornerRectangle(page, [size,size]);
    

    Not sure that's exactly what you're looking for.

    In any case...

    @+

    Marc

  • Distribute the spacing of the text, objects that are in a group does not

    Here's the scenario:

    • create a set of discrete text objects, for example for a web site navigation bar
    • Put them in a group
    • Open the Panel to align objects
    • set the "align on the ' to the 'Selection '.
    • attempt of the distribute spacing (or, in fact, all the Control Panel options align) doesn't seem to work. I have to ungroup the objects first.

    If I choose to align to the artboard, some of the options work.

    It's a ttwii (that's how) or I do something wrong?

    Thanks in advance!

    Steve

    Yes ttwi.

    Align & distribute, aligns and distributes groups, not the items within a group.

    If it was the other way around try to align the Cup/logos/illustrations would create a mess because they are usually groups of several elements.

  • I can't click on some objects, for example, the sign in boxes in facebook

    I can't click on objects, for example, the sign in boxes on facebook

    Hello

    Please check if this happens in Safe Mode. Safe mode disables the installed Extensionsand themes (appearance) in (Alt + T) Tools > Add-ons. Hardware acceleration is also temporarily disabled - manual setting is Tools > Options > Advanced > general > use hardware acceleration when available. All these settings/options/additional custom modules can also be individually or collectively disabled/enabled/changed to normal mode of Firefox to check if an extension, theme, option or a hardware acceleration is causing issues. Deactivation/activation of hardware acceleration and some types of modules in normal mode may require a restart of Firefox.

    Uninstalling the modules

    Uninstalling toolbars

    Troubleshooting Extensions and themes

    Extensions of the issues

    Options

    You can also consider the function of Reset Firefox via help (Alt + H) > troubleshooting information.

  • Now I have firefox at the top of my screen, then file, edit etc, then Home tab and then back, to the front, my bookmarks and then a small space underneath for my pages... If he gat all smallet that resemble my iPhone!

    Now, I have firefox at the top of my screen, then file, edit etc, then welcome tab, then back, forward, then my bookmarks, and then a small space underneath for my pages... If you find any smalliet that it will look like my iPhone! ... I can get red of some or move them?

    Hello

    Please see customization. You can hide/show elements via View (Alt + V) > toolbars.

  • Note: The settings for this page are automatically saved in the Web browser cookies.

    I have a printer of C311a e-all-in-one HP Photosmart 7510.  When you look at the section of customizing built-in browser page printers, at the bottom of the installation of the list can be found this message:

    Note: The settings for this page are automatically saved in the Web browser cookies. If the Web browser cookies are deleted, these settings are lost.

    I would like to the file name for this cookie and can then ensure that this cookie is excluded from cleaning in the various tools that I could use for basic maintenance.  Thank you.

    I suspect that you gave me perfectly fine information.  However, given that this cookie file is not on my machine, determine why would come next.

    In fact, given the costs associated with this effort, profit generated over the lost time and possible third party website access to this particular cookie. all dictate that I have overcome this effort - for now.  I don't respect the time you have invested in answering my question, placing me in your debt in at least a couple of beers.  I want to thank you for the information provided.

    Mark

Maybe you are looking for

  • Abandon Macbook - Retina display

    Here is what happened.   My Macbook 13 "retina fell about 2 1/2 feet on the floor with the screen remains open.  There is light coming from the top monitor at right and bottom left.  Nothing else.   I plugged it in via HDMI and it gives the gray scre

  • Satellite Pro A100-CS3: try to identify the laptop

    Hello My wife received a laptop to use with his work. It is marked as a Satellite Pro A100 CS3. I tried to find the drivers for the WIFI (Win XP) but no Toshiba site does recognize the A100-CS3. Can someone help me out here. Thank you.

  • Windows Vista Sidebar for XP

    Microsoft, as I know, Sidebar available on codename Windows 6.0 or higher, but why is Vista Sidebar available, not only for Windows 6.0 code name, but for XP? Thank U!

  • How to increase the available on report date range

    Hi gurus, On the BigBrother report page, we can define the date range considered. The date start and end on our BigBrother cannot be defined until 2010 (see this screen below). How can I report for 2012 and beyond? Any help will be very appreciated!

  • ADF troubleshooting &amp; Maintenance

    Hi all Check out the video below to learn how to fix paper jams in the ADF Document (CAD) devices HP all-in-one.