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

Is it possible to group 2 objects that are located on 2 different pages in InDesign CS4 JS

Participant ,
Nov 03, 2009 Nov 03, 2009

Is it possible to group 2 objects that are located on 2 different pages. Would it be something like that:

        var myArray = new Array;
        //Add the items to the array.
        myArray.push(myLine1);
        myArray.push(myLine2);
        //Group the items.
        var myPages = app.activeDocument.pages;
        myGroup = myPage.groups.add(myArray);

Thank you very much for your help.

Yulia

TOPICS
Scripting
545
Translate
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
People's Champ ,
Nov 03, 2009 Nov 03, 2009

Unless I am wrong what you can't do in the UI can't also be done by scripting 😉

Loic

Translate
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
Guide ,
Nov 03, 2009 Nov 03, 2009

You can group objects from distinct pages only if they belong to the same spread.

For instance, if you have a rectangle on page 2 and a rectangle on page 3 in a "facing pages" configuration, this should work:

var doc = app.activeDocument;

var r2 = doc.pages[1].rectangles[0]; // rectangle on page 2
var r3 = doc.pages[2].rectangles[0]; // rectangle on page 3

// it's better here to handle the parent spread:

var g = doc.spreads[1].groups.add([r2,r3]);

// but this may also work:

// var g = doc.pages[1].groups.add([r2,r3]);

// var g = doc.pages[2].groups.add([r2,r3]);

@+

Marc

Translate
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
People's Champ ,
Nov 04, 2009 Nov 04, 2009
LATEST

Hi,

You are so right Marc, I was of course pointing that you can't group objects in different spreads. Sorry for my lack of precision and thank you to you to point this out.

Loic

Translate
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