Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

collective specifier instead of grouping/ungrouping #24

Closed
pchiorean opened this issue Apr 9, 2020 · 0 comments
Closed

collective specifier instead of grouping/ungrouping #24

pchiorean opened this issue Apr 9, 2020 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@pchiorean
Copy link
Owner

pchiorean commented Apr 9, 2020

Creating a collective specifier to manage multiple Spread objects. This trick only works with a set of page items that belong to the same spread or page. The goal is to manually create a true specifier to handle those objects collectively. Initially you have an Array of page items. The trick is to group these objects temporarily and to resolve group.pageItems.everyItem():

var page = app.activeDocument.pages[0],
    // an arbitrary array of page items:
    myItems = page.rectangles.everyItem().getElements().
        concat(page.ovals.everyItem().getElements()).
        concat(page.textFrames.everyItem().getElements());
 
// Groups the items ('myItems' is still an Array)
var tempGroup = page.groups.add(myItems);
 
// Converts 'myItems' into a collective specifier:
myItems = tempGroup.pageItems.everyItem();
 
// Resolves myItems
myItems.isValid;
 
// Remove the group
tempGroup.ungroup();
 
// NOW 'myItems' is a nice collective specifier:
myItems.fillColor = 'Black';
// etc.
@pchiorean pchiorean added the enhancement New feature or request label Apr 9, 2020
@pchiorean pchiorean self-assigned this Apr 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant