• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Script to flip objects on all pages

New Here ,
Jan 11, 2025 Jan 11, 2025

Copy link to clipboard

Copied

Hi I'm looking for a script that will flip all objects on all pages of the document on the unlocked layers only. I have a script that I found here that will flip only the object selected but that is very tedious (and can also be done with the transform tool)  when I'm dealing with 250+ page documents. Thanks for any leads!

TOPICS
Scripting

Views

130

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jan 11, 2025 Jan 11, 2025

Hi @jacobs40370360, I'm sure there are further complexities, but here is a simple approach that does what you ask. See if it helps.

- Mark

 

/**
 * Flip Items Horizontally.js
 *
 * Flips every page item horizontally, unless its layer is locked or not visible.
 *
 * @author m1b
 * @discussion https://community.adobe.com/t5/indesign-discussions/script-to-flip-objects-on-all-pages/m-p/15084291
 */
function main() {

    var doc = app.activeDocument,
        items = doc.pageItems;

    for (var i = 
...

Votes

Translate

Translate
Community Expert ,
Jan 11, 2025 Jan 11, 2025

Copy link to clipboard

Copied

Hi @jacobs40370360, I'm sure there are further complexities, but here is a simple approach that does what you ask. See if it helps.

- Mark

 

/**
 * Flip Items Horizontally.js
 *
 * Flips every page item horizontally, unless its layer is locked or not visible.
 *
 * @author m1b
 * @discussion https://community.adobe.com/t5/indesign-discussions/script-to-flip-objects-on-all-pages/m-p/15084291
 */
function main() {

    var doc = app.activeDocument,
        items = doc.pageItems;

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

        var item = items[i];

        if (
            undefined == item
            || !item.hasOwnProperty('geometricBounds')
            || !item.itemLayer
            || item.itemLayer.locked
            || !item.itemLayer.visible
        )
            continue;

        item.transform(
            CoordinateSpaces.PARENT_COORDINATES,
            [[0, 0], BoundingBoxLimits.GEOMETRIC_PATH_BOUNDS, CoordinateSpaces.INNER_COORDINATES],
            app.transformationMatrices.add({
                horizontalTranslation: item.geometricBounds[3] - item.geometricBounds[1],
                horizontalScaleFactor: -1,
                verticalScaleFactor: 1,
            })
        );

    }

}
app.doScript(main, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, 'Flip Items');

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 13, 2025 Jan 13, 2025

Copy link to clipboard

Copied

Worked like a charm, thanks so much for your help!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 13, 2025 Jan 13, 2025

Copy link to clipboard

Copied

LATEST

Good to hear!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 12, 2025 Jan 12, 2025

Copy link to clipboard

Copied

@jacobs40370360 

 

Do you want to "flip" or FLIP properly? 😉

 

 

And why do you want to flip your objects? And what kind of objects?

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines